K
K
keltkelt2019-06-01 17:46:05
git
keltkelt, 2019-06-01 17:46:05

Git, is it possible to get back deleted files, am I confused?

Haven't mastered the git yet.
There is a branch where there were files.
1. I made another branch and moved to it. Did not commit (and there was nothing to commit).
2. Being in the second branch, I made another branch (for tests) and switched to it. It seems to be, it turns out that this is a branch from the second branch?
3. In this branch, I did not commit, but I deleted a couple of files.
Then I realized that I needed these files. And I thought that since I did it in the third branch, in the second - the files must still exist.
Switched to the second - no files. I wanted to switch to the master - it says, make a commit. git status just hangs deleted files.
What did I miss?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
keltkelt, 2019-06-01
@keltkelt

In general, it was necessary to commit the deleted files, otherwise they would not be restored when switching to the previous branch.

K
Konstantin Eliseev, 2019-06-01
@K0r5hun

Try to restore like this:git checkout myfile

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question