Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
28th December 2020, 08:04 | #1 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,784
|
How to selectively apply parts of diff patches?
Does anyone know a GUI tool which allows me to decide which changes in a diff patch I want to apply to my local working directory? Maybe something like "Beyond Compare" or a Tortoise tool...
Beyond Compare is great to compare files in two directories, find differences, and copy each of them manually if desired. I wonder if any similar tool can not only compare two existing directories, but also one directory on one side and the result of applied diff patches on the other side. If not, I will use Beyond Compare on two working directories from different repos... |
28th December 2020, 16:13 | #2 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Suppose you have a local GIT repo in "clean" state and then you manually apply some patch via "patch" command to your working directory. Now, if after applying the patch you run "Git Commit" via TortoiseGit (e.g. from Explorer context menu), this will open the Commit window and show you a list of all files that have been changed (by the patch). If you double-click any of the modified files, it will open the TortoiseGitMerge window and show you all individual changes in that file. Here you can selectively undo any changes you don't want: Just right-click the changed lines that you want to revert, on the right ("Working Tree") side, and choose command "Use other text block" from the context menu. This will restore the original lines. Don't forget to save in TortoiseGitMerge. Once you have reverted any changes you didn't want to have, you can proceed with the commit. And then you can even "export" your commit as a new .diff file containing only the desired changes.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 28th December 2020 at 16:27. |
|
28th December 2020, 19:09 | #4 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Even if you may not have permission to push your new commits to the remote (i.e. the server), you can create as many commits in your local repo as you desire – Git is a decentralized VCS, so your local repo it is fully standalone. You can then use "Show changes as unified diff" command in the commit log, in TortoiseGit, in order to show/save your commits as .diff files. (And, of course, you can always fork the relevant repo on GitHub, or a similar Git hosting site, with one click. This way you can have your very own remote that you can push to) https://i.imgur.com/NK3Jnut.png
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 28th December 2020 at 20:55. |
|
|
|