A collegue of mine forked my project and we want to incorporate his changed on a single file into my repo, keeping its history (mainly the commit logs).
The problem is that he clumsy in his commits so the commits contains diff from other files as well, unrelated to the project (or what need to be pulled into the original repo).
I would like to be able to do a "git format-patch" to extract the history, but only for a single file (or maybe two, the .cpp and .hpp files). I could not find an option to "format-patch" for this.
Is it possible?
Thanx!
You click on Actions->Create Patch... You click on "Working Copy Changes" You can now select all files that should be included into the patch file.
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.
A patch is a text file whose contents are similar to Git diff but along with code it contains metadata about commits, for example, a patch file will include commit ID, date, commit message, etc. We can create a patch from commits and other people can apply them to their repository.
Hum... So actually it's as simple as:
git format-patch commit_id file(s)
where commit_id is the parent of the first commit to create a patch followed by the file or files wanted...
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