Thursday, August 25, 2016

git add with sophictication

I found this git command that I have been looking for forever.
I used to use it then I forgot it and have been googling for it ever since/.

The perfect pairing to git add -p, drum roll please...

git add . -N && git add -p
  • The -N flag means is short for --intent-to-add 
  • git add . -N will stage an empty file representing your newly added file.
    When git add --patch is called 
  • Git will do the normal patch procedure over your newly created file's changes.
  • If no changes are patched in,
    the empty file will not be included in your commit.

Always be sure to check your status!

No comments:

Post a Comment