Permalink
Browse files

add 'git checkout HEAD' and 'git commit -a'

Add commands to skip over the stage and copy files directly between
working directory and the history.

I am not thrilled with including this since it adds clutter and
I generally discourage people from using these commands.  However, many
people do use them so it is probably best to include them.
  • Loading branch information...
1 parent a43f111 commit f3b4c709beae7882c504877eb7d2a63674426cc0 @MarkLodato committed Oct 3, 2011
Showing with 47 additions and 0 deletions.
  1. +1 −0 Makefile
  2. +25 −0 basic-usage-2.tex
  3. +21 −0 index-en.html
View
@@ -4,6 +4,7 @@ PDF2PNG = convert -density 88
FILES := \
basic-usage \
+ basic-usage-2 \
checkout-after-detached \
checkout-b-detached \
checkout-branch \
View
@@ -0,0 +1,25 @@
+\input{common.tex}
+\geometry{papersize={25\g,9\g}}
+\begin{document}
+\begin{tikzpicture}[main]
+ \boundingbox
+ \historynode[0,2]
+ \indexnode[0,0]
+ \worknode[0,-2]
+
+ \path [line]
+ (work.north east)
+ edge node[cmd] {}
+ (index.south east)
+ (work.north east)
+ edge node[cmd] {git commit (\emph{files}|-a)}
+ (head.south east)
+ (head.south west)
+ edge node[cmd] {git checkout HEAD -- \emph{files}}
+ (work.north west)
+ (head.south west)
+ edge
+ (index.north west)
+ ;
+\end{tikzpicture}
+\end{document}
View
@@ -79,6 +79,27 @@ <h2 id="basic-usage">Basic Usage</h2>
<code>git add -p</code> instead of (or in addition to) specifying particular
files to interactively choose which hunks copy.</p>
+ <p>It is also possible to jump over the stage and check out files directly
+ from the history or commit files without staging first.</p>
+
+ <div class="center"><img src='basic-usage-2.svg.png'></div>
+
+ <ul>
+
+ <li><code>git commit -a </code> is equivalent to running <tt>git add</tt>
+ on all filenames that existed in the latest commit, and then running
+ <tt>git commit</tt>.</li>
+
+ <li><code>git commit <em>files</em></code> creates a new commit containing
+ the contents of the latest commit, plus a snapshot of <em>files</em> taken
+ from the working directory. Additionally, <em>files</em> are copied to
+ the stage.</li>
+
+ <li><code>git checkout HEAD -- <em>files</em></code> copies <em>files</em>
+ from the latest commit to both the stage and the working directory.</li>
+
+ </ul>
+
<h2 id="conventions">Conventions</h2>
<p>In the rest of this document, we will use graphs of the following

0 comments on commit f3b4c70

Please sign in to comment.