User:Timothee Flutre/Notebook/Postdoc/2012/08/14: Difference between revisions
From OpenWetWare
(→About Git: put "conflicts" in a separate section) |
(→About Git: add Makefile for pdf) |
||
Line 15: | Line 15: | ||
* '''Need some help''': the learning curve for git is quite steep at the beginning, so it's always worth browsing [https://help.github.com/ help pages], reading [http://gitref.org/ Git Reference], and searching for questions and answers on [http://stackoverflow.com/ stackoverflow]. | * '''Need some help''': the learning curve for git is quite steep at the beginning, so it's always worth browsing [https://help.github.com/ help pages], reading [http://gitref.org/ Git Reference], and searching for questions and answers on [http://stackoverflow.com/ stackoverflow]. | ||
* '''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>. | |||
Line 39: | Line 45: | ||
*** 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>. | ||
** Tips: don't version the output pdf in the repository because, as it is binary, git can't merge it properly. But you can add a Makefile (see below) and, by entering <code>make main -i</code> on the command-line, it will compile your pdf document when you need it | |||
<nowiki> | |||
all: main supp | |||
main: | |||
latex paper_main.tex | |||
bibtex paper_main | |||
latex paper_main.tex | |||
latex paper_main.tex | |||
pdflatex paper_main | |||
supp: | |||
** | latex paper_supplements.tex | ||
** | bibtex paper_supplements | ||
** | latex paper_supplements.tex | ||
latex paper_supplements.tex | |||
pdflatex paper_supplements | |||
clean: | |||
rm -f *~ *.aux *.dvi *.log *.pdf *.bbl *.blg *.toc | |||
</nowiki> | |||
<!-- ##### 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 09:53, 18 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
all: main supp main: latex paper_main.tex bibtex paper_main latex paper_main.tex latex paper_main.tex pdflatex paper_main supp: latex paper_supplements.tex bibtex paper_supplements latex paper_supplements.tex latex paper_supplements.tex pdflatex paper_supplements clean: rm -f *~ *.aux *.dvi *.log *.pdf *.bbl *.blg *.toc |