Difference between revisions of "Using Git"
Jump to navigation
Jump to search
Line 7: | Line 7: | ||
<pre> |
<pre> |
||
git checkout -- . |
git checkout -- . |
||
</pre> |
|||
Note: if you've first done <code>git add</code> (to "stage your changes", so some file is listed under <code>Changes to be committed</code>), you first need to do <code>git reset</code> to unstage the changes, then checkout: |
|||
<pre> |
|||
git reset HEAD . |
|||
git checkout -- . |
|||
</pre> |
</pre> |
||
Revision as of 17:19, 3 October 2013
Removing/undoing your changes to a file
git checkout -- <path>
If "path" is ".", you undo all your changes to version controlled files:
git checkout -- .
Note: if you've first done git add
(to "stage your changes", so some file is listed under Changes to be committed
), you first need to do git reset
to unstage the changes, then checkout:
git reset HEAD . git checkout -- .
Merge conflict: Throw away local changes
git checkout master <path> git commit git merge master
(The last command should now do nothing, just say you're fully merged.)