Work in the same branch and same file with git

3

I'm starting in the world of programming. I still do not control git too well and some problems arise. If I work in my branch, everything is perfect, I have it more or less controlled. But I have had to work with other people and touch the same file.

When uploading changes, I follow the process:

git add <nombre_archivos>
git commit -m <mensaje_del_commit> (No sé para qué sirve la opción -a?)
git push origin <nombre_rama>

When uploading, logically I missed an error: (someone had made changes) Can you see what files you did with a command?

The error:

usuario@pc:~/Documentos/Proyecto/API$ git push --set-upstream origin US1875_pulling
Username for 'https://github.com': user
Password for 'https://[email protected]': ----
To https://github.com/RepositorioProyecto
 ! [rejected]        T1970_Rama -> T1970_Rama (fetch first)
error: failed to push some refs to 'https://github.com/RepositorioProyecto'
consejo: Updates were rejected because the remote contains work that you do
consejo: not have locally. This is usually caused by another repository pushing
consejo: to the same ref. You may want to first integrate the remote changes
consejo: (e.g., 'git pull ...') before pushing again.
consejo: See the 'Note about fast-forwards' in 'git push --help' for details.

How do I see what files you changed before downloading them? Now you should download the changes with:

git pull

before uploading mine, is that correct? And finally, if I have modified the same line, can someone tell me in an easy way how to solve the conflict? Thank you very much

    
asked by Norak 24.08.2017 в 11:31
source

1 answer

2

I understand that what you're looking to do is a diff :

$ git diff HEAD

I hope and serve you

    
answered by 24.08.2017 / 12:39
source