I would highly recommend reading “this post”:http://tomayko.com/writings/the-thing-about-git, it highlights yet another awesome feature of git. Git lets you do your work how you do it, instead of how the SCM says you should. Here is a great example. I have a hopelessly muddled set of changes in filetheother.txt. The changes are for two (or more) different purposes, and I need to only push a portion of it. Enter git add --patch. I can go through each diff element and select to put it in the queue (the Index) for what will be committed.
$ git add --patch file_the_other.txt diff --git a/file_the_other.txt b/file_the_other.txt index 2120d21..e3aa90d 100644 --- a/file_the_other.txt +++ b/file_the_other.txt @@ -1,3 +1,6 @@ +World is here A file like another file, but with different content. -There is even more content here. \ No newline at end of file +There is even more content here. + +Hello World \ No newline at end of file Stage this hunk [y/n/a/d/s/?]?