-1

here is the scenario i have, which i believe is pretty common:

  1. file A on branch master.
  2. i fork master into feature
  3. now i add several commits on the feature branch changing file A.
  4. i undo several edits (by editing the file more to remove the changes) so that the file is the same in branch master because my changes weren't that smart
  5. i do a new change and want to see if i removed everything from before
  6. my first try is git diff master...

but that shows the same diff from git diff it does not show the changes from master to now.

example contents and diff

$ git checkout master
$ cat a
line 1
line 2

$ git checkout feature
$ cat a
line 1-1
line 2-2
line 3
line 4

$ edit a #< from now on a is not indexed, it is locally edited
$ cat a
line 1
line 2
line 3

$ git diff
--- a
- line 1-1
- line 1-2
+ line 1
+ line 2
line 3
- line 4

$ git diff master...
--- a
- line 1-1
- line 1-2
+ line 1
+ line 2
line 3
- line 4

the diff i want to get is:

$ git diff ???
--- a
line 1
line 2
+ line 3
gcb
  • 13,901
  • 7
  • 67
  • 92
  • possible duplicate of [Comparing two branches in GIT?](http://stackoverflow.com/questions/9834689/comparing-two-branches-in-git) – Burhanuddin Sunelwala Mar 18 '15 at 19:56
  • possible duplicate of [Showing which files have changed between git branches](http://stackoverflow.com/questions/822811/showing-which-files-have-changed-between-git-branches) – krlmlr Mar 20 '15 at 16:55
  • to duplicate comments and downvotes: the reason for this question to even exist is because i confused this use case (un-indexed files) with the case in that question (files part of the tree). the accepted answer points out why i was (we are!) wrong in the assumption. – gcb Mar 24 '15 at 21:56

1 Answers1

1

Just do:

git diff master

without "..".

From: http://git-scm.com/docs/git-diff

git diff [--options] <commit> [--] [<path>…]

This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.

Josue Abarca
  • 305
  • 3
  • 8