code_junkie

How do you discard unstaged changes in git?

Nov 10th, 2011
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. git stash save --keep-index
  2.  
  3. git checkout path/to/file/to/revert
  4.  
  5. git checkout -- .
  6.  
  7. git checkout .
  8.  
  9. git checkout-index -a -f
  10.  
  11. git diff | git apply --reverse
  12.  
  13. for f in `git ls-files -m`; do git checkout HEAD -- $f; done
Add Comment
Please, Sign In to add comment