Patch committing in git
When you use git add <filename>
, git stages all the local diffs in that file for committing but if you give the -p
option (as in git add -p <filename>
) git will interactively let you select only some of the diffs in <filename>.
This is useful when you have multiple changes in a file but you need to split up the changes across different commits or if you want to suppress some of the changes from being committed.
This works for any pathspec (example, glob of files).
Written by Venkata Subramanian Mahalingam
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Patch
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#