Skip to content

Instantly share code, notes, and snippets.

@Saissaken
Last active March 7, 2024 18:04
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
@aquaflamingo
Copy link

Thank you 👍

@jaybxyz
Copy link

jaybxyz commented Oct 16, 2019

+1

@Chealer
Copy link

Chealer commented May 1, 2020

I had a failure at line 12 for master (rejection). But line 13 worked, which was the important part for me. Thank you!

@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 !!!

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