vkaul11
vkaul11

Reputation: 4214

Can you recover a file after removing the file using git?

Suppose I am in branch 1, commit file1, and then checkout branch 2 from branch 1. On branch 2, I use git rm file1. If I go back to branch 1 (git checkout branch 1), will I get file1 back?

Upvotes: 0

Views: 38

Answers (1)

Caleb
Caleb

Reputation: 125037

will I get file1 back?

Yes, of course. It's part of branch 1, and you haven't merged branch 2 into branch 1, so the file still exists in branch 1.

Upvotes: 1

Related Questions