[Privoxy-devel] git: how2 show diff for one specific change?

Brian Mahaffy bmahaffy at cradlepoint.com
Fri Mar 9 16:57:50 UTC 2018


You can get a diff of the specific changes from a particular SHA with the following command.  Lets use SHA 12345678 in the example.

git diff 12345678^ 12345678

What you asked for there was for Git to diff the SHA _one_ previous (indicated with the ‘^’ after the SHA) with the original SHA.

Here’s an example from the repo:
$ git diff 8b27fea8^ 8b27fea8
diff --git a/regression-tests.action b/regression-tests.action
index 750caed7..c55d7c5c 100644
--- a/regression-tests.action
+++ b/regression-tests.action
@@ -705,6 +705,7 @@ TAG:^Proxy-Authorization header forwarding$
 # Fetch Test = http://config.privoxy.org/show-status?file=invalid
 # Fetch Test = http://config.privoxy.org/show-status?file=trust
 # Fetch Test = http://p.p/show-version
+# Expect Status Code = 404
 # Fetch Test = http://p.p/show-request
 # Fetch Test = http://p.p/show-url-info
 # Fetch Test = http://p.p/show-url-info?url=www.privoxy.org%2F


If you add the following to your ~/.gitconfig file, you can use any visual diff tool you would like.  I have mine set to use the Beyond Compare tool from ScooterSoftware (http://www.scootersoftware.com/) which is great, but YMMV so use whatever you like.  You can similarly setup tools for merges as well.

[diff]
tool = extGitDiff

[difftool]
prompt = false

[difftool "extGitDiff"]
cmd = /usr/local/bin/bcomp \"$LOCAL\" \"$REMOTE\"
trustExitCode = true


To use the visual diff tool that previous Git diff command would become:

git difftool 12345678^ 12345678

If you just want to see what files changed and how for a change, then the command becomes:

git diff —raw 12345678^ 12345678

Here is an example from a recent checkin in the repo:
$ git diff --raw 6aa48485^ 6aa48485
:100644 100644 318e6598... 650d0552... M        doc/source/faq.sgml

There are some excellent Git books available for free out there.  I’d start with this one: https://git-scm.com/book/en/v2 for getting your introduction to things.

Hope this helps!  Please yell if you have questions.

…Brian M

On Mar 9, 2018, at 09:14 AM, Lee <ler762 at gmail.com<mailto:ler762 at gmail.com>> wrote:

On 3/9/18, Fabian Keil  wrote:
Lee  wrote:

So I can do a
git log
& see what change I want listed, but what's the command to show >>just
that<< change?

there's got to be something better than git show > /tmp/x && vi /tmp/x
but I'm not seeing it.

I'm not sure I understand the question correctly, but you can
pass a hash as argument to "git show" to only show a specific
commit.

that's what I was looking for:
 git show -U7 <id>

Thanks!!

Lee
_______________________________________________
Privoxy-devel mailing list
Privoxy-devel at lists.privoxy.org<mailto:Privoxy-devel at lists.privoxy.org>
https://lists.privoxy.org/mailman/listinfo/privoxy-devel



More information about the Privoxy-devel mailing list