The other day I went back to an old branch that had about five files that were changed and I only wanted to incorporate two of them into my master branch. In order to just merge in a couple, I used git merge with the –no-commit option.

git merge --no-commit planner

This merges in all changes but doesn’t commit it. Since it isn’t committed, it’s easy to roll back individual files. I ran git status to get a list of files and rolled back several files with git checkout. When I was done, I had only the two files I wanted to merge showing up when I ran git status.