#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
Thank you!