Last Updated: February 25, 2016
·
420
· klj613

git everything -p

By everything I mean:

git checkout -p
git reset -p
git stash -p
git add -p
and possibly more...

What do these do? well if you know git add -p then you can easily guess. However they can be used in many different combinations.


One use for git checkout -p is to revert a 'hunk' which is commited into HEAD. e.g. git checkout -p -- filename.ext. You can also do this for any ref! such as git checkout HEAD~10 -p -- filename.ext or git checkout branch-name -p -- filename.ext