Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

aquaflamingo commented Apr 9, 2019

Thank you 👍

@kogisin
Copy link

kogisin 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

shahabedinh commented Jan 20, 2021

Thank you 👍👍👍

@leonhelmus
Copy link

leonhelmus commented Feb 1, 2021

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

maliberty commented Jan 20, 2022

👍

@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

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