diff --git a/git-tutorial.tex b/git-tutorial.tex index 31da1715d1554c4dc4d6a35de6b97cce2b0f9cf5..95311146865c7707cdf3e71ba54bdb300eaa6693 100644 --- a/git-tutorial.tex +++ b/git-tutorial.tex @@ -409,10 +409,34 @@ the file given as argument. \subsubsection*{merge} \label{merge} +\begin{lstlisting} +andersn@stodola: git pull /tmp/git-tutorial +remote: Counting objects: 5, done. +remote: Compressing objects: 100% (3/3), done. +remote: Total 3 (delta 2), reused 0 (delta 0) +Unpacking objects: 100% (3/3), done. +From /tmp/git-tutorial + * branch HEAD -> FETCH_HEAD +Auto-merging git-tutorial.tex +CONFLICT (content): Merge conflict in git-tutorial.tex +Automatic merge failed; fix conflicts and then commit the result. +\end{lstlisting} +When we open the file containing the conflict we find a section with +conflict markers;\\ +\verb|<<<<<<< local version ======= remote version >>>>>>>| +\begin{lstlisting} +<<<<<<< HEAD Sometimes it happens that merge conflicts are introduced, the most common occasion is when two users happen to edit the same lines of a file. - +======= +Bla bla bla bla bla bla +>>>>>>> 82b8fb8e2f4985b12dfb9d402be069eeb070db92 +\end{lstlisting} +Resolve the conflict by editing the file and choose which version, or +combination of them, that should be kept. In the above case it seems +pretty obvious that the second version is just crap so we remove it as +well as the conflict markers. Then we commit the resolved file. \section{Further Reading}