How to add changes in one file to two different commits in Git?
Let's say you were working on an update but needed to push some partial code in a fix or another update. To do it, you can quickly call the interactive add feature of git to select the portions of code you want to add using the following:
git add -p
This is also helpful if you want to know what you are adding.
Originally Posted On: Github (k88hudson)