0

The situation is:

        branch2
        /
       /
master
       \
        \
       branch1

I created a file (aaaa.py) in branch1, but I didn't commit it. Later I changed to branch2 and I did some changes in the file (aaaa.py) and I committed it in this branch (branch2) but now I want to restore the file (aaaa.py) like it was at branch1 before it was changed.

IMPORTANT: Now aaaa.py doesn't exist in branch1 because I didn't commit it in that branch.

How I can do it?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
d00rt
  • 17
  • 3

1 Answers1

0

If you are on branch2 and want to restore aaa.py as it is in branch1, you can do

git checkout branch1 -- path/to/aaaa.py
Melou
  • 874
  • 6
  • 10
  • The problem is that the file aaaa.py doesn't exist in branch1 becose when I commited it on branch2 it disappeared – d00rt Jun 13 '16 at 15:01