Project of a branch of git?

1

How do I download (clone) and upload changes to a branch in git?

I have been using git for a while, to download the latest version I used

git -pull

and to upload my changes I did it with

git push 

but I overwrote the changes to the changes my friend made, so how do I work in sync?

    
asked by deluf 04.05.2017 в 10:46
source

1 answer

7

To work with branches, the procedure is as follows:

If you do not have the branch down:

git clone -b nombre-rama https://github.com/nombre-repositorio

If you already have the folder with the branch down:

git pull

(you only need to pull because the .git already knows that you are working with the branch)

You make all the changes you want.

To upload it simply do:

git add . #puedes cambiar el '.' por el/los fichero/s concreto que quieras.
git commit -m "Descripción de tus cambios"
git push

Keep in mind that between pull and push, if your partner makes a change in the branch and upload it, it will conflict with the last version you downloaded and will not let you upload it. Then you would have to do a pull to copy the last changes of your partner again.

    
answered by 04.05.2017 / 11:19
source