Write slides about merge with conflict
This commit is contained in:
parent
c6c938207f
commit
1df85219c9
7 changed files with 127 additions and 3 deletions
15
code-examples/python-cat.py
Normal file
15
code-examples/python-cat.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def cat():
|
||||||
|
print("Meow")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] == "cat":
|
||||||
|
cat()
|
||||||
|
else:
|
||||||
|
print("HELLO WORLD")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
15
code-examples/python-dog.py
Normal file
15
code-examples/python-dog.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def dog():
|
||||||
|
print("Woof")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] == "dog":
|
||||||
|
dog()
|
||||||
|
else:
|
||||||
|
print("HELLO WORLD")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
20
code-examples/python-merged.py
Normal file
20
code-examples/python-merged.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
def cat():
|
||||||
|
print("Meow")
|
||||||
|
|
||||||
|
def dog():
|
||||||
|
print("Woof")
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] == "cat":
|
||||||
|
cat()
|
||||||
|
elif len(sys.argv) > 1 and sys.argv[1] == "dog":
|
||||||
|
dog()
|
||||||
|
else:
|
||||||
|
print("HELLO WORLD")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
40
main.latex
40
main.latex
|
@ -655,8 +655,8 @@
|
||||||
git switch test # or
|
git switch test # or
|
||||||
git checkout test
|
git checkout test
|
||||||
# Create and switch in one go
|
# Create and switch in one go
|
||||||
git switch -cc test # or
|
git switch -c test # or
|
||||||
git checkout -be test
|
git checkout -b test
|
||||||
\end{minted}
|
\end{minted}
|
||||||
|
|
||||||
\note{%
|
\note{%
|
||||||
|
@ -726,9 +726,43 @@
|
||||||
\begin{frame}
|
\begin{frame}
|
||||||
\frametitle{Tidy Up}
|
\frametitle{Tidy Up}
|
||||||
\begin{center}
|
\begin{center}
|
||||||
\includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{auto-shell-simple-merge.pdf}
|
\includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{auto-shell-delete-test-branch.pdf}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
|
\note{%
|
||||||
|
Now that we have finished with that branch, we can delete it.
|
||||||
|
}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{More Complex merge}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{auto-shell-complex-merge.pdf}
|
||||||
\end{center}
|
\end{center}
|
||||||
\note{%
|
\note{%
|
||||||
|
At times, git won't be able to merge automatically.
|
||||||
|
|
||||||
|
Dealing with merges is something that there are around a million different tools you can use but I think they over complicate what is actually quite a simple process.
|
||||||
|
}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{More Complex merge}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{auto-shell-cat-complex-merge.pdf}
|
||||||
|
\end{center}
|
||||||
|
\note{%
|
||||||
|
Here you can see that the bit(s) git couldn't work out are delimited by \mintinline{bash}{<<<<<<<} and \mintinline{bash}{>>>>>>>} and separated by \mintinline{bash}{=======}.
|
||||||
|
|
||||||
|
All you (the programmer) needs to do is fix it.
|
||||||
|
}
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}
|
||||||
|
\frametitle{More Complex merge}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{auto-shell-fix-complex-merge.pdf}
|
||||||
|
\end{center}
|
||||||
|
|
||||||
\note{%
|
\note{%
|
||||||
}
|
}
|
||||||
|
|
6
shell/cat-complex-merge
Executable file
6
shell/cat-complex-merge
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd /tmp/demo
|
||||||
|
echo '$ cat greeting.py'
|
||||||
|
cat greeting.py
|
||||||
|
|
20
shell/complex-merge
Executable file
20
shell/complex-merge
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
cd /tmp/demo
|
||||||
|
git switch master > /dev/null
|
||||||
|
git branch dog > /dev/null
|
||||||
|
cp "${DIR}/../code-examples/python-cat.py" greeting.py > /dev/null
|
||||||
|
git add greeting.py > /dev/null
|
||||||
|
git commit -m "Makes a cat say Meow" > /dev/null
|
||||||
|
git switch dog > /dev/null
|
||||||
|
cp "${DIR}/../code-examples/python-dog.py" greeting.py > /dev/null
|
||||||
|
git add greeting.py > /dev/null
|
||||||
|
git commit -m "Makes a dog say Woof" > /dev/null
|
||||||
|
git switch master > /dev/null
|
||||||
|
echo " # Make changes to 2 branches in the same place #"
|
||||||
|
echo '$ git switch master'
|
||||||
|
echo '$ git log --oneline --all --graph'
|
||||||
|
git -c color.ui=always log --oneline --all --graph --decorate=short
|
||||||
|
echo '$ git merge dog'
|
||||||
|
git merge dog --no-edit
|
14
shell/fix-complex-merge
Executable file
14
shell/fix-complex-merge
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
DIR="$(dirname "$(readlink -f "$0")")"
|
||||||
|
cd /tmp/demo
|
||||||
|
cp "${DIR}/../code-examples/python-merged.py" greeting.py > /dev/null
|
||||||
|
echo '$ vim greeting.py'
|
||||||
|
echo ' # Fix the conflict(s) #'
|
||||||
|
echo '$ git add greeting.py'
|
||||||
|
git add greeting.py
|
||||||
|
echo '$ git commit'
|
||||||
|
git commit -F .git/COMMIT_EDITMSG
|
||||||
|
echo '$ git log --oneline --all --graph'
|
||||||
|
git -c color.ui=always log --oneline --all --graph --decorate=short
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue