On a project I am looking after, one user has helpfully provided a large bunch of changes as a single patch. 80%+ is very good and should be included in the project. However there are a few changes he is proposing where I do not agree at all (He has misunderstood how one feature works). How can I with git be selective on his proposed changes. I have read about git checkout -p but don't understand how to use it, if this is the best answer.
1 Answer
- Normally apply patch to working tree
- Use
git add -ito interactively select files or parts of files to stage.- to add whole file use
2 update - to review changes on selected files use
5 patch, in this mode for every change git will ask you if you want to stage it or not
- to add whole file use
- Commit staged changes, things you don't want will stay in working tree.
- If you wish to clean working tree of unwanted changes use
git resetandgit clean