3
How to work on someone else's branch
source link: https://gist.github.com/elfrank/c08256de9c15e41e1781
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to work on someone else's branch · GitHub
Instantly share code, notes, and snippets.
How to work on someone else's branch
#How to work on someone else's branch
Let's assume you need to collaborate with Batman on his forked repository.
- First, you need to add his fork as a remote.
git remote add batman [email protected]:batman/iambatman.git
- Now, you can fetch, pull and push to his fork (if you have permissions to do so).
git fetch batman
- So, to add changes to the
savegotham
branch, you must:
# batman is the name of the remote
git checkout -b local-branch-name batman/savegotham
# ...Make changes to local files...
git add -A
git commit -m "The joker is dead"
# batman -> name of remote, savegotham -> name of branch
git push batman savegotham
####Notes:
- See your remotes with
git remote -v
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK