-
Is there a shortcut to get the Gdiff for a file from the arbitrary commit that I'm looking at. One use case is to pull changes from a previous commit for a file. For e.g. selectively reverting some change. One way I could do that is:
Can these steps be shortened with a shortcut in the commit view itself, to get the diff against the current file? Actually, this will need to be the previous commit for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
After you press enter to open the relevant commit, the cursor should be on the relevant Edit: If you don't want to seek out a nearby |
Beta Was this translation helpful? Give feedback.
After you press enter to open the relevant commit, the cursor should be on the relevant
+
line in the diff for the file. If you move to a nearby-
line and press enter again, it will take you to that line just before it was removed, which is in the previous commit as you desire. Call:Gdiffsplit
from there to achieve your desired result.Edit: If you don't want to seek out a nearby
-
line (because you're trying to script the whole process, for example), press enter on the+
line, and then use:Gedit >!^
to jump back one commit. The!
means "the currently edited file's commit",^
means "back one" as in Git, and>
is a special notation to use the current filename and try to find the same line.