Skip to content

Commit

Permalink
Merge pull request #329 from rgaiacs/checkout-stages
Browse files Browse the repository at this point in the history
Mention that "git checkout <commit> <file>" stages
  • Loading branch information
iglpdc committed Feb 7, 2017
2 parents 32530f9 + 9f9562d commit 6d0d15c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions _episodes/05-history.md
Expand Up @@ -227,6 +227,44 @@ $ git checkout f22b25e mars.txt
~~~
{: .bash}

~~~
$ cat mars.txt
~~~
{: .bash}

~~~
Cold and dry, but everything is my favorite color
~~~
{: .output}

~~~
$ git status
~~~
{: .bash}

~~~
# On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: mars.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
~~~
{: .output}

Notice that the changes are on the staged area.
Again, we can put things back the way they were with
by using `git checkout`:

~~~
$ git checkout -f master mars.txt
~~~
{: .bash}

> ## Don't Lose Your HEAD
>
> Above we used
Expand Down

0 comments on commit 6d0d15c

Please sign in to comment.