Commit dc7975de authored by bow's avatar bow

Add "git --checkout -- ." command

parent df62604c
...@@ -187,6 +187,43 @@ ...@@ -187,6 +187,43 @@
\end{lstlisting} \end{lstlisting}
\end{frame} \end{frame}
\begin{frame}[fragile]
\frametitle{Undoing changes.}
Keep in mind that ``\bt{git reset}'' by default sets a staged file back to unstaged.
\begin{lstlisting}[language=none, caption=Unstage a file.]
$ git reset README
$ git status
# Changes not staged for commit:
# modified: README
\end{lstlisting}
\bigskip
\pause
To discard all changes in an unstaged file, you can use ``\bt{git checkout}''
\begin{lstlisting}[language=none, caption=Discarding changes.]
$ git checkout -- .
$ git status
nothing to commit, working directory clean
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Undoing changes.}
For now, let's commit our change and move on.
\bigskip
\begin{lstlisting}[language=none, caption=Adding a new version of a file.]
$ echo Second version. > README
$ git commit
$ git status
nothing to commit, working directory clean
\end{lstlisting}
\bigskip
\end{frame}
\begin{frame}[fragile] \begin{frame}[fragile]
\frametitle{Viewing the history.} \frametitle{Viewing the history.}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment