I was reading this (old) posting on GIT and read the following:
By using
git add --p, you can choose which patches from a file you want to include for checkin.The result is that the index contains a version of the file which is not in your working copy.
My question is twofold:
- Is this still true?
- How do I bring the changes back in from index after I’ve done this?
I think that you might be misunderstanding what
git add -pdoes.git add -pis something which you can use if you have files modified in your working copy, but for which you only want to apply some of the difference from those files to your index. Thus, you wind up with something in your index which only contains some of the changes that you have in your working copy. It doesn’t have anything to do with a patch file; it just lets you choose parts of the difference between your working copy and HEAD to apply to the index.If you want to apply a patch file to your index and/or working copy, use
git apply. By default this will just apply changes to your working copy, and you will have to add them to the index usinggit add; however, you can use--indexto also add them to the index, or--cachedto only add them to the index, without modifying the working copy.If you have a large number of patches to apply in a mailbox, you can use
git amto apply a whole series of patches at once.