User:Timothee Flutre/Notebook/Postdoc/2012/08/14: Difference between revisions
From OpenWetWare
(→About Git: add tip on config) |
(→About Git: put "conflicts" in a separate section) |
||
Line 39: | Line 39: | ||
*** One can look at the differences file by file: <code>git diff --color-words colleague1:paper_main.tex master:paper_main.tex</code>. The options "--color-words" is especially useful in LaTeX. | *** One can look at the differences file by file: <code>git diff --color-words colleague1:paper_main.tex master:paper_main.tex</code>. The options "--color-words" is especially useful in LaTeX. | ||
*** To merge the content of the recently-updated local "master" into his own local branch, we do: <code>git merge master</code>. | *** To merge the content of the recently-updated local "master" into his own local branch, we do: <code>git merge master</code>. | ||
* | |||
* '''Conflicts''': when updating one branch with the content of another one (<code>git checkout branch1; git merge branch2</code>), some conflicts can happen, and it is usually hard to know how to solve them properly. In the following, branch1 can be master and branch2 can be origin/master, or branch1 can be tim and branch2 can be master. | |||
** The first solution is to edit the files by hand and choose which version we want to keep for each conflict. | |||
** The second solution is to ignore the conflicts and overwrite the files of branch1 with the content of branch2, one file at a time: <code>git checkout --patch branch2 fileX.txt</code>. | |||
** The third solution, even more radical, is to "overwrite" all of branch1 with the content of the branch2, all files at once: <code>git reset --hard branch2</code>. | |||
<!-- ##### DO NOT edit below this line unless you know what you are doing. ##### --> | <!-- ##### DO NOT edit below this line unless you know what you are doing. ##### --> |
Revision as of 07:53, 17 December 2012
Project name | <html><img src="/images/9/94/Report.png" border="0" /></html> Main project page <html><img src="/images/c/c3/Resultset_previous.png" border="0" /></html>Previous entry<html> </html>Next entry<html><img src="/images/5/5c/Resultset_next.png" border="0" /></html> |
About Git
|