2

I had lots of changes in my local git fork, I do:

  1. git add -A
  2. git commit -m "commit message"
  3. pull changes from upstream master
  4. rebase
  5. git push to my origin

Now It happens that there are several other commits (from others) between my previous commit and my new commit.

I want to see all the changes done by me in my new commit and work on it. So, I do

git reset --soft <my previous commit>

It shows files modified by me and also by others.

Question:

  1. What would be the way to see files modified only by me?
  2. And then the files are shown as modified, is it possible to unstage them? I want to see the changes when I do git diff.
Maroun
  • 94,125
  • 30
  • 188
  • 241
Ashish Ranjan
  • 12,760
  • 5
  • 27
  • 51

2 Answers2

5

You are making things so complex. Instead of soft reset, simply use git diff and pass your commit and the one before to see what has been changed:

git diff xxxxxx yyyyyy

Where xxxxxx is the first and yyyyyy is the second commit hash values. To get the commit hash value use git reflog.

More info here.

UPDATE:

As suggested in comments, you can also use git difftool xxxxxx yyyyyy for a visual diff.

Yaser
  • 5,609
  • 1
  • 15
  • 27
  • ... or `git difftool xxxxx yyyyy` for a visual diff. Maybe you could include that in your answer. – eckes Dec 04 '16 at 07:56
2

You can filter only your commits then compare with HEAD.

$ git log --author=<user>           # see your  commits and copy commit-sha
$ git diff <commit-sha>..HEAD       # shows what is in HEAD that is not in <commit>
Sajib Khan
  • 22,878
  • 9
  • 63
  • 73