PageRenderTime 58ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/exports/git.tex

https://gitlab.com/sharez/git-fast-furious
LaTeX | 931 lines | 798 code | 129 blank | 4 comment | 0 complexity | 69444aa9ef4bd400004d27781d595e1b MD5 | raw file
  1. \documentclass[a4paper,10pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{lmodern}
  4. \usepackage{amssymb,amsmath}
  5. \usepackage{ifxetex,ifluatex}
  6. %\usepackage{fixltx2e} % provides \textsubscript
  7. % use upquote if available, for straight quotes in verbatim environments
  8. \IfFileExists{upquote.sty}{\usepackage{upquote}}{}
  9. \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  10. \usepackage[utf8]{inputenc}
  11. \else % if luatex or xelatex
  12. \ifxetex
  13. \usepackage{mathspec}
  14. \usepackage{xltxtra,xunicode}
  15. \else
  16. \usepackage{fontspec}
  17. \fi
  18. \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  19. \newcommand{\euro}{}
  20. \fi
  21. % use microtype if available
  22. \IfFileExists{microtype.sty}{\usepackage{microtype}}{}
  23. \usepackage{color}
  24. \usepackage{fancyvrb}
  25. \newcommand{\VerbBar}{|}
  26. \newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
  27. \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
  28. % Add ',fontsize=\small' for more characters per line
  29. \newenvironment{Shaded}{}{}
  30. \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
  31. \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
  32. \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  33. \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  34. \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
  35. \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  36. \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
  37. \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
  38. \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
  39. \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  40. \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
  41. \newcommand{\RegionMarkerTok}[1]{{#1}}
  42. \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
  43. \newcommand{\NormalTok}[1]{{#1}}
  44. \ifxetex
  45. \usepackage[setpagesize=false, % page size defined by xetex
  46. unicode=false, % unicode breaks when used with xetex
  47. xetex]{hyperref}
  48. \else
  49. \usepackage[unicode=true]{hyperref}
  50. \fi
  51. \hypersetup{breaklinks=true,
  52. bookmarks=true,
  53. pdfauthor={},
  54. pdftitle={},
  55. colorlinks=true,
  56. citecolor=blue,
  57. urlcolor=blue,
  58. linkcolor=magenta,
  59. pdfborder={0 0 0}}
  60. \urlstyle{same} % don't use monospace font for urls
  61. \setlength{\parindent}{0pt}
  62. \setlength{\parskip}{6pt plus 2pt minus 1pt}
  63. \setlength{\emergencystretch}{3em} % prevent overfull lines
  64. \setcounter{secnumdepth}{0}
  65. \title{GIT: Fast and Furious}
  66. \author{Shahab Rezaee <\href{mailto:shahabrezaee@gmail.com}{shahabrezaee@gmail.com}>}
  67. \date{}
  68. \begin{document}
  69. \maketitle
  70. \section{What is Git?}\label{what-is-git}
  71. Git is:
  72. \begin{itemize}
  73. \itemsep1pt\parskip0pt\parsep0pt
  74. \item
  75. A Distributed version control, means:
  76. \begin{itemize}
  77. \itemsep1pt\parskip0pt\parsep0pt
  78. \item
  79. Each user maintain their own repository
  80. \end{itemize}
  81. \item
  82. A tool that tracks changes instead of versions, specially for text
  83. content
  84. \end{itemize}
  85. Every single updates are \textbf{change sets} which shapes repository
  86. state. There is no master repository but many working copies which
  87. contains their own \textbf{change sets}. Example: All of the followings
  88. may be valid:
  89. \begin{verbatim}
  90. Repo 1: A -- B -- C -- D -- E -- F
  91. Repo 2: A -- B -- C
  92. Repo 3: A -- B -- E -- F
  93. \end{verbatim}
  94. So, there is no centralized copy on server tracking every movements!
  95. \emph{\textbf{Goodbye dictators! Hello FREEDOM!}}
  96. Triumphs:
  97. \begin{itemize}
  98. \itemsep1pt\parskip0pt\parsep0pt
  99. \item
  100. No network access required
  101. \item
  102. No single point of \emph{FAILIER}
  103. \item
  104. Developers could works independently
  105. \item
  106. Easier code review process
  107. \end{itemize}
  108. Git generally is not good for tracking binary files. So, storing many
  109. binary objects in git is bad habit! (see Git LFS)
  110. \section{Creation!}\label{creation}
  111. \begin{Shaded}
  112. \begin{Highlighting}[]
  113. \NormalTok{$ }\KeywordTok{cd} \NormalTok{path/to/repository/root/}
  114. \NormalTok{$ }\KeywordTok{git} \NormalTok{init}
  115. \end{Highlighting}
  116. \end{Shaded}
  117. See \texttt{.git} directory!
  118. Create your first files. Commit your changes.
  119. \begin{Shaded}
  120. \begin{Highlighting}[]
  121. \NormalTok{$ }\KeywordTok{touch} \NormalTok{first.txt}
  122. \NormalTok{$ }\KeywordTok{git} \NormalTok{add .}
  123. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"Initial commit!"}
  124. \end{Highlighting}
  125. \end{Shaded}
  126. \texttt{-m} means message. You could use \texttt{git commit} to access
  127. editor to write multi line commit message. You could specify editor in
  128. eather \texttt{\textasciitilde{}/.bashrc} or
  129. \texttt{\textasciitilde{}/.bash\_profile} :
  130. \begin{Shaded}
  131. \begin{Highlighting}[]
  132. \KeywordTok{export} \OtherTok{EDITOR=}\NormalTok{nano}
  133. \end{Highlighting}
  134. \end{Shaded}
  135. Write good messages for commits.
  136. (\href{http://chris.beams.io/posts/git-commit/}{How to write a Git
  137. Commit Message}) Use meaningful conventions such as issue numbers,
  138. support tickets, git refs and etc in message title.
  139. Now, see current changes:
  140. \begin{Shaded}
  141. \begin{Highlighting}[]
  142. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  143. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --since=}\StringTok{"2016-06-04"}
  144. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --until=}\StringTok{"2016-06-04"}
  145. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --author=}\StringTok{"Shahab"}
  146. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --grep=}\StringTok{"Init"}
  147. \end{Highlighting}
  148. \end{Shaded}
  149. \begin{Shaded}
  150. \begin{Highlighting}[]
  151. \NormalTok{$ }\KeywordTok{git} \NormalTok{help}
  152. \NormalTok{$ }\KeywordTok{git} \NormalTok{help init}
  153. \end{Highlighting}
  154. \end{Shaded}
  155. \section{Git structure}\label{git-structure}
  156. \subsection{Git levels}\label{git-levels}
  157. \begin{verbatim}
  158. +--------------+
  159. | repository |
  160. / +--------------+
  161. |
  162. | git commit
  163. |
  164. \ +-----------------+
  165. | staging index |
  166. / +-----------------+
  167. |
  168. | git add
  169. |
  170. \ +---------------------+
  171. | working directory |
  172. +---------------------+
  173. \end{verbatim}
  174. \subsection{Change Sets}\label{change-sets}
  175. \begin{itemize}
  176. \itemsep1pt\parskip0pt\parsep0pt
  177. \item
  178. \textbf{change set} is a single patch file may affects many files in
  179. repository.
  180. \item
  181. Git generates a SHA-1 checksum for every \textbf{change set}.
  182. \item
  183. SHA-1 guaranties that same data have a same checksum.
  184. \item
  185. SHA-1 generate 40 character hexadecimal ({[}0-9a-f{]}) string.
  186. \end{itemize}
  187. \begin{verbatim}
  188. +------------+
  189. | checksum |
  190. +------------+
  191. | parent |
  192. +------------+
  193. | author |
  194. +------------+
  195. | message |
  196. +------------+
  197. \end{verbatim}
  198. Example: Consider followings are initial commits of repository:
  199. \begin{verbatim}
  200. A -- B -- C
  201. \end{verbatim}
  202. thus:
  203. \begin{verbatim}
  204. A.parent == NULL
  205. B.parent == A.checksum
  206. C.parent == B.checksum
  207. \end{verbatim}
  208. \subsection{HEAD}\label{head}
  209. HEAD is:
  210. \begin{itemize}
  211. \itemsep1pt\parskip0pt\parsep0pt
  212. \item
  213. pointer to tip of current branch of repository
  214. \item
  215. last state of repository checked out
  216. \item
  217. parent of next commit
  218. \end{itemize}
  219. \begin{Shaded}
  220. \begin{Highlighting}[]
  221. \NormalTok{$ }\KeywordTok{cd} \NormalTok{.git}
  222. \NormalTok{$ }\KeywordTok{ls} \CommentTok{# there is a file named HEAD}
  223. \NormalTok{$ }\KeywordTok{cat} \NormalTok{HEAD }\CommentTok{# location of current head}
  224. \NormalTok{$ }\KeywordTok{cd} \NormalTok{refs/heads}
  225. \NormalTok{$ }\KeywordTok{cat} \NormalTok{master }\CommentTok{# checksum of lastest commit}
  226. \end{Highlighting}
  227. \end{Shaded}
  228. \section{Create changes!}\label{create-changes}
  229. \begin{Shaded}
  230. \begin{Highlighting}[]
  231. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# there is no changes}
  232. \NormalTok{$ }\KeywordTok{touch} \NormalTok{second.txt}
  233. \NormalTok{$ }\KeywordTok{touch} \NormalTok{third.txt}
  234. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# there are untracked files (changes not staged)}
  235. \NormalTok{$ }\KeywordTok{git} \NormalTok{add second.txt}
  236. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# second.txt staged to be commited, third.txt still untracked}
  237. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"Add second.txt to the project"}
  238. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# third.txt is untracked}
  239. \NormalTok{$ }\KeywordTok{git} \NormalTok{log }\CommentTok{# new commit is listed}
  240. \NormalTok{$ }\KeywordTok{git} \NormalTok{add third.txt}
  241. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"Add third file to the project"}
  242. \NormalTok{$ }\KeywordTok{git} \NormalTok{log }\CommentTok{# another commit is listed}
  243. \NormalTok{$ }\KeywordTok{echo} \StringTok{"a new line at the end"} \KeywordTok{>>} \NormalTok{first.txt}
  244. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# first.txt is modified. changes are tracked but not staged yet}
  245. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff }\CommentTok{# see difference between current working directory and HEAD}
  246. \NormalTok{$ }\KeywordTok{echo} \StringTok{"hellllllllllllllllllllo again!"} \KeywordTok{>>} \NormalTok{third.txt}
  247. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff }\CommentTok{# multiple file changes}
  248. \NormalTok{$ }\KeywordTok{git} \NormalTok{add first.txt}
  249. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff }\CommentTok{# Oh staged changes are not available}
  250. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff --staged }\CommentTok{# dada! see differences between staged index and HEAD (git 1.7+, --cached for prev.)}
  251. \NormalTok{$ }\KeywordTok{git} \NormalTok{add third.txt}
  252. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"Minor bottom changes ;)"}
  253. \NormalTok{$ }\KeywordTok{touch} \NormalTok{to_be_deleted.txt}
  254. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"Add files to delete later"}
  255. \NormalTok{$ }\KeywordTok{rm} \NormalTok{to_be_deleted.txt}
  256. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# changes not staged}
  257. \NormalTok{$ }\KeywordTok{git} \NormalTok{rm to_be_deleted.txt}
  258. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# delete is staged to be commited}
  259. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"to_be_deleted is now deleted!"}
  260. \NormalTok{$ }\KeywordTok{touch} \NormalTok{return_of_to_be_deleted.txt}
  261. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"To Be Deleted: The Return"}
  262. \NormalTok{$ }\KeywordTok{git} \NormalTok{rm return_of_to_be_deleted.txt}
  263. \NormalTok{$ }\KeywordTok{ls} \CommentTok{# Horay! It's gone!}
  264. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# It's also staged!}
  265. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"Fixing consistant to_be_deleted.txt bug"}
  266. \NormalTok{$ }\KeywordTok{mv} \NormalTok{first.txt primary.txt}
  267. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# seems first.txt is deleted (tracked), primary.txt is created (untracked)}
  268. \NormalTok{$ }\KeywordTok{git} \NormalTok{add primary.txt}
  269. \NormalTok{$ }\KeywordTok{git} \NormalTok{rm first.txt}
  270. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# OH! Shit! git got it! it's renamed!}
  271. \NormalTok{$ }\KeywordTok{git} \NormalTok{mv second.txt secondary.txt}
  272. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# Horay! renamed and staged!}
  273. \end{Highlighting}
  274. \end{Shaded}
  275. \begin{Shaded}
  276. \begin{Highlighting}[]
  277. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset HEAD --hard }\CommentTok{# we describe it later!}
  278. \NormalTok{$ }\KeywordTok{nano} \NormalTok{first.txt }\CommentTok{# change something in one line}
  279. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff first.txt}
  280. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff --color-words first.txt}
  281. \end{Highlighting}
  282. \end{Shaded}
  283. \section{Time machine! Get things back or OMG! I am in love with
  284. Git!}\label{time-machine-get-things-back-or-omg-i-am-in-love-with-git}
  285. \subsection{From working directory to
  286. HEAD}\label{from-working-directory-to-head}
  287. \subsubsection{Undo changes of one file}\label{undo-changes-of-one-file}
  288. \begin{Shaded}
  289. \begin{Highlighting}[]
  290. \NormalTok{$ }\KeywordTok{echo} \StringTok{"I gonna falllllll%@#%}\OtherTok{$#}\StringTok{^#%&"} \KeywordTok{>>} \NormalTok{first.txt}
  291. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# Next day when I check the repo: Ohhhh!}
  292. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout -- first.txt }\CommentTok{# git checkout first.txt will work on many cases but what if we have a branch called 'first.txt'! god bless '--'}
  293. \end{Highlighting}
  294. \end{Shaded}
  295. \subsection{From staged to working
  296. directory}\label{from-staged-to-working-directory}
  297. \begin{Shaded}
  298. \begin{Highlighting}[]
  299. \NormalTok{$ }\KeywordTok{echo} \StringTok{"I gonna falllllll%@#%}\OtherTok{$#}\StringTok{^#%&"} \KeywordTok{>>} \NormalTok{first.txt }\KeywordTok{&&} \KeywordTok{git} \NormalTok{add first.txt}
  300. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# my god! they are staged!}
  301. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset HEAD first.txt}
  302. \end{Highlighting}
  303. \end{Shaded}
  304. \subsection{From committed to working
  305. directory}\label{from-committed-to-working-directory}
  306. \begin{Shaded}
  307. \begin{Highlighting}[]
  308. \NormalTok{$ }\KeywordTok{echo} \StringTok{"I gonna falllllll%@#%}\OtherTok{$#}\StringTok{^#%&"} \KeywordTok{>>} \NormalTok{first.txt }\KeywordTok{&&} \KeywordTok{git} \NormalTok{commit -am }\StringTok{"sombjhgsv f hsafhi fbuf"}
  309. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  310. \NormalTok{$ }\KeywordTok{git} \NormalTok{log }\CommentTok{# HOLY CRAP! They are commited}
  311. \end{Highlighting}
  312. \end{Shaded}
  313. Consider this:
  314. \begin{verbatim}
  315. A -- B -- C -- D -- E
  316. \end{verbatim}
  317. We already know that each commit is depends to the previous commit. So
  318. if we remove one, repository would loose its data integrety. However, we
  319. may able to change the last commit!
  320. \subsubsection{Change last commit}\label{change-last-commit}
  321. \begin{Shaded}
  322. \begin{Highlighting}[]
  323. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -amend -m }\StringTok{"A nice good morning message!"}
  324. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# Nothing!}
  325. \NormalTok{$ }\KeywordTok{git} \NormalTok{log }\CommentTok{# message of last commit is looking nice! Note that checksum and date are change too.}
  326. \NormalTok{$ }\KeywordTok{echo} \StringTok{"one more other line"} \KeywordTok{>>} \NormalTok{first.txt}
  327. \NormalTok{$ }\KeywordTok{echo} \StringTok{"one more other line"} \KeywordTok{>>} \NormalTok{second.txt}
  328. \NormalTok{$ }\KeywordTok{git} \NormalTok{add first.txt}
  329. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -m }\StringTok{"Append one more line to first and second"} \CommentTok{# oops! we forgot second one!}
  330. \NormalTok{$ }\KeywordTok{git} \NormalTok{add second.txt}
  331. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit --amend --no-edit }\CommentTok{# Save or change message! Done!}
  332. \end{Highlighting}
  333. \end{Shaded}
  334. \subsubsection{Bring commited changes out of
  335. commit}\label{bring-commited-changes-out-of-commit}
  336. \begin{Shaded}
  337. \begin{Highlighting}[]
  338. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout CHECKSUM -- first.txt}
  339. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  340. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset HEAD first.txt}
  341. \end{Highlighting}
  342. \end{Shaded}
  343. \subsubsection{Revert last commit!}\label{revert-last-commit}
  344. \begin{Shaded}
  345. \begin{Highlighting}[]
  346. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout -- first.txt }\CommentTok{# Back to last commit}
  347. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  348. \NormalTok{$ }\KeywordTok{git} \NormalTok{revert CHECKSUM }\CommentTok{# revert last commit: git revert HEAD}
  349. \NormalTok{$ }\KeywordTok{git} \NormalTok{log }\CommentTok{# a revert commit!}
  350. \NormalTok{$ }\KeywordTok{git} \NormalTok{revert CHECKSUM }\CommentTok{# try to revert to older commits may cause confilicts}
  351. \NormalTok{$ }\KeywordTok{git} \NormalTok{revert --abort }\CommentTok{# return to last state}
  352. \end{Highlighting}
  353. \end{Shaded}
  354. \subsection{To infinity\ldots{} and
  355. beyond!}\label{to-infinity-and-beyond}
  356. There are three kind of reset:
  357. \begin{itemize}
  358. \itemsep1pt\parskip0pt\parsep0pt
  359. \item
  360. soft: no changes in niether staged index nor working directory
  361. \item
  362. mixed (default): change staged index to match HEAD but apply no
  363. changes to the working directory
  364. \item
  365. hard: change both staged index and working directory to match HEAD
  366. \end{itemize}
  367. \subsubsection{Soft reset}\label{soft-reset}
  368. \begin{Shaded}
  369. \begin{Highlighting}[]
  370. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/HEAD}
  371. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/refs/heads/master}
  372. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  373. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --soft CHECKSUM}
  374. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  375. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  376. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff --staged}
  377. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/refs/heads/master}
  378. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --soft CHECKSUM_OF_LATESET }\CommentTok{# it's not destructive}
  379. \end{Highlighting}
  380. \end{Shaded}
  381. \subsubsection{Mixed reset}\label{mixed-reset}
  382. \begin{Shaded}
  383. \begin{Highlighting}[]
  384. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  385. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --mixed CHECKSUM}
  386. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  387. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# committed changes are unstaged now}
  388. \NormalTok{$ }\KeywordTok{git} \NormalTok{add .}
  389. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset HEAD FILENAME}
  390. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --mixed CHECKSUM_OF_LATESET }\CommentTok{# it's not destructive too}
  391. \end{Highlighting}
  392. \end{Shaded}
  393. \subsubsection{Hard reset}\label{hard-reset}
  394. \begin{Shaded}
  395. \begin{Highlighting}[]
  396. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  397. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard CHECKSUM}
  398. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  399. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# Nothing here!}
  400. \NormalTok{$ }\KeywordTok{echo} \StringTok{"this would be gone!"} \KeywordTok{>>} \NormalTok{first.txt}
  401. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard HEAD}
  402. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# nothing here! may be destructive or painful!}
  403. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard CHECKSUM_OF_LATESET }\CommentTok{# it's here again but we are lucky because it's not collected yet!}
  404. \end{Highlighting}
  405. \end{Shaded}
  406. \subsubsection{Reset the Reset}\label{reset-the-reset}
  407. \begin{Shaded}
  408. \begin{Highlighting}[]
  409. \NormalTok{$ }\KeywordTok{git} \NormalTok{reflog }\CommentTok{# git help reflog}
  410. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard HEAD~3}
  411. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  412. \NormalTok{$ }\KeywordTok{git} \NormalTok{reflog}
  413. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard HEAD@}\DataTypeTok{\{1\}}
  414. \end{Highlighting}
  415. \end{Shaded}
  416. \subsection{From dirty to clean!}\label{from-dirty-to-clean}
  417. \begin{Shaded}
  418. \begin{Highlighting}[]
  419. \NormalTok{$ }\KeywordTok{touch} \NormalTok{jerk1.txt}
  420. \NormalTok{$ }\KeywordTok{touch} \NormalTok{jerk2.txt}
  421. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  422. \NormalTok{$ }\KeywordTok{git} \NormalTok{clean}
  423. \NormalTok{$ }\KeywordTok{git} \NormalTok{clean -n }\CommentTok{# Test run of clean command}
  424. \NormalTok{$ }\KeywordTok{git} \NormalTok{add jerk1.txt}
  425. \NormalTok{$ }\KeywordTok{git} \NormalTok{clean -f }\CommentTok{# jerk1.txt still here}
  426. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset HAED jerk1.txt}
  427. \NormalTok{$ }\KeywordTok{git} \NormalTok{clean -f}
  428. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  429. \end{Highlighting}
  430. \end{Shaded}
  431. \section{Ignorance!}\label{ignorance}
  432. \begin{Shaded}
  433. \begin{Highlighting}[]
  434. \NormalTok{$ }\KeywordTok{touch} \NormalTok{to_be_ignored.txt}
  435. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  436. \NormalTok{$ }\KeywordTok{touch} \NormalTok{.gitignore}
  437. \end{Highlighting}
  438. \end{Shaded}
  439. .gitignore accept patterns in each line:
  440. \begin{itemize}
  441. \item
  442. Very basic regular experssins * ? {[}aeiou{]} {[}0-9{]}
  443. \item
  444. \texttt{!} means NOT! Example: \texttt{*.jpg !logo.jpg}
  445. \item
  446. Triling slash ignores directoris: \texttt{static/}
  447. \end{itemize}
  448. \begin{Shaded}
  449. \begin{Highlighting}[]
  450. \NormalTok{$ }\KeywordTok{echo} \StringTok{"*_ignored.*"} \KeywordTok{>>} \NormalTok{.gitignore}
  451. \NormalTok{$ }\KeywordTok{git} \NormalTok{status }\CommentTok{# It's ignored}
  452. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"add gitignore"}
  453. \end{Highlighting}
  454. \end{Shaded}
  455. See \href{https://github.com/github/gitignore}{github .gitignores} You
  456. could create global ignorance with \texttt{git config}.
  457. Now if we want to ignore tracked files:
  458. \begin{Shaded}
  459. \begin{Highlighting}[]
  460. \NormalTok{$ }\KeywordTok{echo} \StringTok{"third.txt"} \KeywordTok{>>} \NormalTok{.gitignore}
  461. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  462. \NormalTok{$ }\KeywordTok{echo} \StringTok{"some changes!"} \KeywordTok{>>} \NormalTok{third.txt}
  463. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  464. \NormalTok{$ }\KeywordTok{git} \NormalTok{rm --cached third.txt}
  465. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"Untrack third.txt but still available from repository"}
  466. \end{Highlighting}
  467. \end{Shaded}
  468. Git ignores empty directories by default, so if you want add an empty
  469. directory to project add \texttt{.gitkeep} to it!
  470. \section{Go to a git trip!}\label{go-to-a-git-trip}
  471. Every Tree-ish are a git trip ticket! But wait a min! What is a
  472. Tree-ish:
  473. \begin{itemize}
  474. \itemsep1pt\parskip0pt\parsep0pt
  475. \item
  476. something that references part of a tree
  477. \item
  478. is \texttt{ish} because it's vary widly
  479. \item
  480. is referencing a commit
  481. \end{itemize}
  482. Tree-ish:
  483. \begin{itemize}
  484. \itemsep1pt\parskip0pt\parsep0pt
  485. \item
  486. Full 40 char checksum
  487. \item
  488. Part of checksum (4 char at least) from left.
  489. \item
  490. HEAD pointer
  491. \item
  492. branch refs
  493. \item
  494. tags refs
  495. \item
  496. ancestry
  497. \end{itemize}
  498. Ancestry:
  499. \begin{itemize}
  500. \itemsep1pt\parskip0pt\parsep0pt
  501. \item
  502. Parent commit:
  503. \begin{itemize}
  504. \itemsep1pt\parskip0pt\parsep0pt
  505. \item
  506. \texttt{HEAD\^{}}, \texttt{1f9c5bb\^{}}, \texttt{master\^{}}
  507. \item
  508. \texttt{HEAD\textasciitilde{}1}, \texttt{HEAD\textasciitilde{}}
  509. \end{itemize}
  510. \item
  511. Grandparent Commit:
  512. \begin{itemize}
  513. \itemsep1pt\parskip0pt\parsep0pt
  514. \item
  515. \texttt{HEAD\^{}\^{}}, \texttt{1f9c5bb\^{}\^{}},
  516. \texttt{master\^{}\^{}}
  517. \item
  518. \texttt{HEAD\textasciitilde{}2}
  519. \end{itemize}
  520. \item
  521. Great-grandparent commit:
  522. \begin{itemize}
  523. \itemsep1pt\parskip0pt\parsep0pt
  524. \item
  525. \texttt{HEAD\^{}\^{}\^{}}, \texttt{1f9c5bb\^{}\^{}\^{}},
  526. \texttt{master\^{}\^{}\^{}}
  527. \item
  528. \texttt{HEAD\textasciitilde{}3}
  529. \end{itemize}
  530. \end{itemize}
  531. \subsection{Tree-ish contents}\label{tree-ish-contents}
  532. \begin{Shaded}
  533. \begin{Highlighting}[]
  534. \NormalTok{$ }\KeywordTok{git} \NormalTok{ls-tree HEAD}
  535. \NormalTok{$ }\KeywordTok{git} \NormalTok{ls-tree --name-only}
  536. \NormalTok{$ }\KeywordTok{git} \NormalTok{show HEAD}
  537. \NormalTok{$ }\KeywordTok{git} \NormalTok{show CHECKSUM_OF_BLOB}
  538. \NormalTok{$ }\KeywordTok{git} \NormalTok{show first.txt }\CommentTok{# ambiguous}
  539. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff HEAD~2..HEAD}
  540. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff --stat HEAD~2..HEAD}
  541. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff -b TREEISH..TREEISH }\CommentTok{# ignores space changes}
  542. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff -w TREEISH..TREEISH }\CommentTok{# ignores all spaces}
  543. \end{Highlighting}
  544. \end{Shaded}
  545. \subsection{Logs}\label{logs}
  546. \begin{Shaded}
  547. \begin{Highlighting}[]
  548. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline}
  549. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --since=}\StringTok{"2 days ago"}
  550. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --until=2.days}
  551. \NormalTok{$ }\KeywordTok{git} \NormalTok{log HEAD~5..HEAD~}
  552. \NormalTok{$ }\KeywordTok{git} \NormalTok{log -- first.txt}
  553. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --stat --summary}
  554. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --format=short}
  555. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --graph --decorate}
  556. \end{Highlighting}
  557. \end{Shaded}
  558. \section{Branches}\label{branches}
  559. \subsection{Create, Move and Delete}\label{create-move-and-delete}
  560. \begin{Shaded}
  561. \begin{Highlighting}[]
  562. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch}
  563. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch new_feature}
  564. \NormalTok{$ }\KeywordTok{git} \NormalTok{brance}
  565. \NormalTok{$ }\KeywordTok{ls} \NormalTok{-la .git/refs/heads}
  566. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/refs/heads/new_feature}
  567. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout new_feature}
  568. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/HEAD}
  569. \NormalTok{$ }\KeywordTok{echo} \StringTok{"in new branch"} \KeywordTok{>>} \NormalTok{second.txt}
  570. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"new feature aded"}
  571. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  572. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout master}
  573. \NormalTok{$ }\KeywordTok{git} \NormalTok{log}
  574. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout new_feature}
  575. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout -b feature_hotfix}
  576. \NormalTok{$ }\KeywordTok{echo} \StringTok{"it is too hoooooooot"} \KeywordTok{>>} \NormalTok{second.txt}
  577. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"it's feel warmer now"}
  578. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout master}
  579. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --graph --decorate --all}
  580. \NormalTok{$ }\KeywordTok{echo} \StringTok{"some annoing not commited"} \KeywordTok{>>} \NormalTok{first.txt}
  581. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout new_feature }\CommentTok{# Cause error! It should be mostly clean}
  582. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard HEAD}
  583. \NormalTok{$ }\KeywordTok{touch} \NormalTok{temp.txt}
  584. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout new_feature }\CommentTok{# this is the meaning of 'mostly clean'}
  585. \NormalTok{$ }\KeywordTok{git} \NormalTok{status}
  586. \NormalTok{$ }\KeywordTok{rm} \NormalTok{temp.txt}
  587. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff master..new_feature}
  588. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch --merged}
  589. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout master}
  590. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -m new_feature feature}
  591. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch delete_me}
  592. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -d delete_me}
  593. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout -b delete_again}
  594. \NormalTok{$ }\KeywordTok{echo} \StringTok{"this will be deleted"} \KeywordTok{>>} \NormalTok{first.txt}
  595. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"rest in peace"}
  596. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout master}
  597. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -d delete_again }\CommentTok{# Are you sure?}
  598. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -D delete_again}
  599. \end{Highlighting}
  600. \end{Shaded}
  601. \subsection{Merge}\label{merge}
  602. \begin{verbatim}
  603. A---B---C [feature]
  604. /
  605. D---E---F---G---H [master]
  606. A---B---C [feature]
  607. / \
  608. D---E---F---G---H [master]
  609. \end{verbatim}
  610. \begin{Shaded}
  611. \begin{Highlighting}[]
  612. \NormalTok{$ }\KeywordTok{git} \NormalTok{merge feature}
  613. \NormalTok{$ }\KeywordTok{git} \NormalTok{merge --no-ff hotfix}
  614. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch --merged}
  615. \end{Highlighting}
  616. \end{Shaded}
  617. Strategies to avoid conflicts: - Keep lins short - keep commit short -
  618. merge often
  619. \section{Stash}\label{stash}
  620. \begin{Shaded}
  621. \begin{Highlighting}[]
  622. \NormalTok{$ }\KeywordTok{echo} \StringTok{"I am editing this file"} \KeywordTok{>>} \NormalTok{first.txt}
  623. \NormalTok{$ }\KeywordTok{git} \NormalTok{stach save }\StringTok{"some changes"}
  624. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash list}
  625. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash show REF}
  626. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash show -p REF}
  627. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash pop REF}
  628. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash list}
  629. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash}
  630. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash list}
  631. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash apply REF}
  632. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash list}
  633. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash drop REF}
  634. \NormalTok{$ }\KeywordTok{git} \NormalTok{stash clear}
  635. \end{Highlighting}
  636. \end{Shaded}
  637. \section{Remotes}\label{remotes}
  638. \begin{Shaded}
  639. \begin{Highlighting}[]
  640. \NormalTok{$ }\KeywordTok{git} \NormalTok{remote add origin URL}
  641. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/config}
  642. \NormalTok{$ }\KeywordTok{git} \NormalTok{remote}
  643. \NormalTok{$ }\KeywordTok{git} \NormalTok{remote -v}
  644. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/config}
  645. \NormalTok{$ }\KeywordTok{git} \NormalTok{remote rm origin}
  646. \NormalTok{$ }\KeywordTok{git} \NormalTok{remote add origin URL}
  647. \NormalTok{$ }\KeywordTok{git} \NormalTok{push -u origin master}
  648. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/config}
  649. \NormalTok{$ }\KeywordTok{ls} \NormalTok{.git/refs/remote}
  650. \NormalTok{$ }\KeywordTok{ls} \NormalTok{.git/refs/remote/origin}
  651. \NormalTok{$ }\KeywordTok{cat} \NormalTok{.git/refs/remote/master}
  652. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -r}
  653. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -a}
  654. \NormalTok{$ }\KeywordTok{git} \NormalTok{diff master origin/master}
  655. \NormalTok{$ }\KeywordTok{git} \NormalTok{merge origin/feature}
  656. \NormalTok{$ }\KeywordTok{git} \NormalTok{push origin :delete_me}
  657. \NormalTok{$ }\KeywordTok{git} \NormalTok{push origin --delete delete_me}
  658. \end{Highlighting}
  659. \end{Shaded}
  660. \section{Rebase}\label{rebase}
  661. \begin{verbatim}
  662. A---B---C [feature]
  663. /
  664. D---E---F---G [master]
  665. A'--B'--C' [feature]
  666. /
  667. D---E---F---G [master]
  668. \end{verbatim}
  669. \begin{Shaded}
  670. \begin{Highlighting}[]
  671. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout -b extra_feature master}
  672. \NormalTok{$ }\KeywordTok{echo} \StringTok{"landing giant boeing"} \KeywordTok{>>} \NormalTok{first.txt}
  673. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"initial commit -- extra feature"}
  674. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout -b hotfix_chili master}
  675. \NormalTok{$ }\KeywordTok{echo} \StringTok{"An chili pepper here!"} \KeywordTok{>>} \NormalTok{second.txt}
  676. \NormalTok{$ }\KeywordTok{git} \NormalTok{commit -am }\StringTok{"fix a hot a possible"}
  677. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout master}
  678. \NormalTok{$ }\KeywordTok{git} \NormalTok{merge hotfix_chili}
  679. \NormalTok{$ }\KeywordTok{git} \NormalTok{branch -d hotfix_chili}
  680. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --decorate}
  681. \NormalTok{$ }\KeywordTok{git} \NormalTok{checkout extra_feature}
  682. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --decorate}
  683. \NormalTok{$ }\KeywordTok{git} \NormalTok{rebase master}
  684. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --decorate}
  685. \NormalTok{$ }\KeywordTok{git} \NormalTok{reflog}
  686. \NormalTok{$ }\KeywordTok{git} \NormalTok{reset --hard HEAD@}\DataTypeTok{\{NUM\}}
  687. \NormalTok{$ }\KeywordTok{git} \NormalTok{rebase -i master}
  688. \NormalTok{$ }\KeywordTok{git} \NormalTok{push -f origin extra_feature }\CommentTok{# should push forcefully}
  689. \end{Highlighting}
  690. \end{Shaded}
  691. The Golden Rule of Rebasing: \textbf{Once you understand what rebasing
  692. is, the most important thing to learn is when not to do it. The golden
  693. rule of git rebase is to never use it on public branches.} see:
  694. \href{https://www.atlassian.com/git/tutorials/merging-vs-rebasing}{Merge
  695. vs Rebase}
  696. \section{Tagging}\label{tagging}
  697. \begin{Shaded}
  698. \begin{Highlighting}[]
  699. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --decorate}
  700. \NormalTok{$ }\KeywordTok{git} \NormalTok{tag v0.1.0}
  701. \NormalTok{$ }\KeywordTok{git} \NormalTok{tag}
  702. \NormalTok{$ }\KeywordTok{git} \NormalTok{show v0.1.0}
  703. \NormalTok{$ }\KeywordTok{git} \NormalTok{tag -a v0.1.0rc HAED~1 -m }\StringTok{"First RC realse"}
  704. \NormalTok{$ }\KeywordTok{git} \NormalTok{log --oneline --decorate}
  705. \NormalTok{$ }\KeywordTok{git} \NormalTok{reflog}
  706. \NormalTok{$ }\KeywordTok{git} \NormalTok{push origin --tags}
  707. \end{Highlighting}
  708. \end{Shaded}
  709. \section{Git workflow}\label{git-workflow}
  710. see:
  711. \href{https://www.atlassian.com/git/tutorials/comparing-workflows/}{Comparing
  712. Workflows}
  713. \subsection{Centralized Workflow}\label{centralized-workflow}
  714. \begin{itemize}
  715. \itemsep1pt\parskip0pt\parsep0pt
  716. \item
  717. Everyone works on master!
  718. \item
  719. Needs many rebases
  720. \item
  721. Confilicts are totaly accepted!
  722. \item
  723. Only one branch make the way clean (!?)
  724. \end{itemize}
  725. \subsection{Feature Branch Workflow}\label{feature-branch-workflow}
  726. \begin{itemize}
  727. \itemsep1pt\parskip0pt\parsep0pt
  728. \item
  729. Every feature have thier own brach
  730. \item
  731. Based on pull requests
  732. \item
  733. Less confilicts may happens
  734. \item
  735. There may be many waits for a branch owner to finish their work
  736. \end{itemize}
  737. \subsection{Gitflow Workflow}\label{gitflow-workflow}
  738. see: \href{http://nvie.com/posts/a-successful-git-branching-model/}{A
  739. successful Git branching model}
  740. \begin{itemize}
  741. \itemsep1pt\parskip0pt\parsep0pt
  742. \item
  743. There are 5 basic branch type:
  744. \item
  745. master: stable release
  746. \item
  747. develop: main development branch
  748. \item
  749. feature: branch for new feature development
  750. \item
  751. release: branch from develop for every single feature releases
  752. e.g.~1.5.2 -\textgreater{} 1.6 not 1.5.3 nor 2.0
  753. \item
  754. hotfix: branch from master to apply hotfixes to master
  755. \item
  756. Compatible with \href{http://semver.org/}{semver}
  757. \item
  758. Rare confilicts
  759. \item
  760. Descentralized while Centralized
  761. \item
  762. Very collaborative atmosphere
  763. \item
  764. Never breaks stable releases
  765. \item
  766. A bit complex to handle, nevertheless there is a handy automation tool
  767. \end{itemize}
  768. \href{https://github.com/nvie/gitflow}{git-flow} is a tool to automate
  769. this model. see:
  770. \href{http://danielkummer.github.io/git-flow-cheatsheet/}{git-flow
  771. cheatsheet}
  772. \subsection{Forking Workflow}\label{forking-workflow}
  773. \begin{itemize}
  774. \itemsep1pt\parskip0pt\parsep0pt
  775. \item
  776. Every member works on thier own copy of repository (fork)
  777. \item
  778. Based on pull requests
  779. \item
  780. There is a maintainer responsible to merge everything
  781. \item
  782. Prevents unwanted changes to main repository
  783. \item
  784. Usually opensource/public projects use this model
  785. \end{itemize}
  786. \subsection{Patch Workflow}\label{patch-workflow}
  787. see: \href{http://rypress.com/tutorials/git/patch-workflows}{Patch
  788. Workflows}
  789. \begin{itemize}
  790. \itemsep1pt\parskip0pt\parsep0pt
  791. \item
  792. Every member works on thier own copy of repository (fork)
  793. \item
  794. Based on emailed patches! (see:
  795. \href{https://git-scm.com/book/en/v2/Git-Commands-Email}{A3.9 Git
  796. Commands - Email})
  797. \item
  798. There is a maintainer responsible to merge everything
  799. \item
  800. Linux Kernel uses this model!
  801. \end{itemize}
  802. \end{document}