I have one file called test.c in my git repo.

Now i have performed some delat1 changes on test.c and performed git add command. and now git status -s gives as below output.

git add test.c
git status -s
M  test.c

Now i have again performed delat2 changes on top of (test.c + delat1) and now git status -s shows as below

git status -s
MM  test.c

(First M is green and 2nd M is displayed in red font in vim)

Now i want to remove my delta2 changes. and want to go back at test.c + delat1 changes level

How to do that?

1 Answers

4
padawin On Best Solutions

If your run git status, you will see your local files ("delta2"), your staged files ("delta1").

As git status tells you, to get rid of your local changes ("delta2"), you can run:

git checkout test.c

The file will then be at the state of "delta1"