Please sign in to comment.
Sunday's post on reverting files, sprucing up the site a bit
- Loading branch information...
Showing with 39 additions and 10 deletions.
|@@ -0,0 +1,22 @@|
|+title: reverting files|
|+This is a topic that is a constant source of confusion for many git users, basically because there's more than one way to skin the proverbial cat. Let's go over some of the basic commands that you'll need to undo your work.|
|+So, you just want to revert one file back to its original state:|
|+@git checkout <file>@|
|+One problem with this is that you may have is that a file and branch named the same. Since the checkout command is used for both reverting files and swapping out to a different branch, you'll need to use this syntax (thanks, "Norbauer":http://norbauer.com/notebooks/code/notes/git-revert-reset-a-single-file)|
|+@git checkout -- <file>@|
|+If you want to throw out all of the changes you've been working on, there's two ways to do that.|
|+@git checkout -f@ or @git reset --HARD@|
|+Once these commands are run you'll lose all of the work that isn't committed in your directory, so make sure to take caution when using them.|
|+Also, be aware that "'git revert' is not equivalent to 'svn revert'!":http://bryan-murdock.blogspot.com/2007/07/git-revert-is-not-equivalent-to-svn.html @git-revert@ is used to reverse commits, something another tip will cover in the future.|