Skip to content

Instantly share code, notes, and snippets.

@Saissaken
Last active November 12, 2024 02:24
Show Gist options
  • Save Saissaken/b555f2c0772bee56601f70df501b6c96 to your computer and use it in GitHub Desktop.
Save Saissaken/b555f2c0772bee56601f70df501b6c96 to your computer and use it in GitHub Desktop.
Update git fork with tags
# Repo: someuser/myframework
# Fork: superteam/myframework
# Track:
git clone https://github.com/superteam/myframework.git
cd myframework
git remote add upstream https://github.com/someuser/myframework.git
# Update:
git fetch upstream
git rebase upstream/master
git push
git push --tags
@shahabedinh
Copy link

Thank you 👍👍👍

@leonhelmus
Copy link

Thanks! This worked great :).

@bwiens
Copy link

bwiens commented Jul 26, 2021

I didn't need git rebase upstream/master and it still worked to get the latest tags/release

@maliberty
Copy link

👍

@sunheat
Copy link

sunheat commented Mar 20, 2022

Thanks for the tip. But my fork's remote is missing some refs. How do I push them to my fork remote?
For instance, there is refs/remotes/upstream/4.13 after I did git fetch upstream, but after I pushed to my fork origin remote, I do not have that ref in the origin remote. I only have the old ones up to refs/remotes/origin/4.12. How do I resolve this?

P.S. tags are indeed synchronized. I don't know the difference between tags and refs in remotes.

@sunheat
Copy link

sunheat commented Mar 20, 2022

Thanks for the tip. But my fork's remote is missing some refs. How do I push them to my fork remote? For instance, there is refs/remotes/upstream/4.13 after I did git fetch upstream, but after I pushed to my fork origin remote, I do not have that ref in the origin remote. I only have the old ones up to refs/remotes/origin/4.12. How do I resolve this?

P.S. tags are indeed synchronized. I don't know the difference between tags and refs in remotes.

It was somewhat a dumb question. The thing is a branch. I can use some suggestions on how to synchronize branches from upstream. I did something like the following but wasn't sure if it is correct.

git push origin refs/tags/4.13.1:refs/heads/4.13

only because 4.13.1 was the latest tag in 4.13. Maybe I should have pushed local 4.13 to remote refs/heads/4.13? But interestingly enough, for this particular repo, there are no local branches when I forked the upstream and cloned it to my local.
I did git branch and got the following:

$ git branch
* master

@ckerr
Copy link

ckerr commented Dec 5, 2022

Works. Thank you!

@ihsanberahim-openmindsresources

@dmchandru
Copy link

Thank you!

@rebcabin
Copy link

another "thank you." cleaned up what I thought was a hopeless loss.

@Skyb0rg
Copy link

Skyb0rg commented Oct 8, 2023

Works perfectly .... thank you !!!

@henryrobbins
Copy link

+1 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment