3

I have created an alias for this git diff --stat origin/master.

The alias for this is

[alias]
  dp = "!DIFF_PREVIEW=$(git diff --stat origin/master HEAD);"

When I run dp, Git Bash works, but it does not show anything in the terminal window. If I type git diff --stat origin/master, it actually shows my commits in the terminal window.

How can I modify my alias so it reproduces this as well?

2
  • 1
    You're using a command substitution to save the output of that Git command to a variable called DIFF_PREVIEW; that's why running git dp prints nothing. Why are you doing that? Are you using the value of DIFF_PREVIEW at all? Commented Apr 23, 2015 at 14:06
  • No I am not. I thought you had to do it this way Commented Apr 23, 2015 at 14:35

1 Answer 1

3

Just

[alias]
  dp = diff --stat origin/master HEAD

should work.

Sign up to request clarification or add additional context in comments.

3 Comments

That does work but it shows me every single commit. How can I modify it so it just shows my commits?
@user3259232 It's hard to do with diff, you may use git log -p [email protected].
@user3259232 What do you mean by "it shows me every single commit"? git diff compares two commits, those corresponding to origin/master and HEAD, here. Those are the only two commits that your command will tell you about... Moreover, please don't "move the goalpost" by adding new, unrelated requirements in the comments. Either edit your question or ask a new question, if you have to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.