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.
In order to create Git patch file for a specific commit, use the “git format-patch” command with the “-1” option and the commit SHA. In order to get the commit SHA, you have to use the “git log” command and look for the corresponding commit SHA.
The first rule takes precedence in the case of a single <commit>. To apply the second rule, i.e., format everything since the beginning of history up until <commit>, use the --root option: git format-patch --root <commit> . If you want to format only <commit> itself, you can do this with git format-patch -1 <commit> .
git add -i
to interactively select files or parts of files to stage.
2 update
5 patch
, in this mode for every change git will ask you if you want to stage it or notgit reset
and git clean
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With