Skip to content

Instantly share code, notes, and snippets.

@jjthrash
Created November 15, 2012 14:57
Show Gist options
  • Select an option

  • Save jjthrash/4079031 to your computer and use it in GitHub Desktop.

Select an option

Save jjthrash/4079031 to your computer and use it in GitHub Desktop.
Editing new files as you stage them
# Why? You might want to remove log files, commented code.. generally clean up your
# code before you stage it. You might also want to remove function that isn't ready
# yet in order to keep your commits concise and meaningful.
# stage an empty version of the file so we can git add --patch later
git add -N thefile
# add --patch, so we can tweak the file (via the edit hunk feature) before it's
# staged
git add --patch thefile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment