Reputation: 2980
I want to upgrade a forked repo which I forked 1 year ago to a specific tag. Anyone know how to do this ?
Upvotes: 2
Views: 1067
Reputation: 131
Let's do it step by step:
git clone [email protected]:[user_name]/[repo_name].git
cd [repo_name]
git remote add upstream [email protected]:[Username_forked_repo]/[repo_name].git
git branch -r
commandgit fetch upstream
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | grep -E 'upstream/' | while read remote; do git branch --track "${remote#upstream/}" "$remote"; done
git push --all origin
git push origin --tags
Upvotes: 0
Reputation: 2980
I solved my problem by following these steps:
git checkout master
git remote add upstream <origianl_repo_link>
git fetch upstream
git rebase --onto tags/<tag_name> upstream/master master
Upvotes: 0
Reputation: 39638
If you did not already do that:
upstream
remote to the original repository (git remote add upstream <url>
)Then:
git fetch upstream --tags
git checkout -b <branchname> <tagname>
After that, you will have a new branch named branchname which is at the same state as the tag. Finally,
git push origin <branchname>
pushes the new branch to your GitHub fork of the repository.
(I assume this is what you want; if you just want to have the tags in your fork, use git push origin --tags
)
Upvotes: 6