How do I download(clone) and push changes to a branch in git?
I have been using git for a long time, to download the latest version I used
git -pull
and to upload my changes I did it with
git push
but it overwrites the changes that my friend made, so how do I make it work in sync?
To work with branches, the procedure is as follows:
If you don't have the branch down:
If you already have the folder with the downloaded branch:
(you only need to pull since the .git already knows that you are working with the branch)
You make all the changes you want.
To upload it simply do:
Keep in mind that between pulling and pushing, if your partner makes any changes to the branch and pushes it, it will conflict with the last version you downloaded and won't let you push it. Then you would have to pull to copy your partner's latest changes again.