Reputation: 3090
After creating a new git branch, I removed some files. Then I decided I wanted to discard these changes and removed the branch without merging. However the files are not back. What should I do?
The steps I followed:
git checkout -b newbranche
git checkout master
and git branch -D newbranche
git status
I get an overview of all the deleted files under "Changes not staged for commit". It also says: use "git checkout -- ..." to discard changes in working directory.How can I fully undo the changes/deleted files I made in the 'newbranche' branch?
Upvotes: 1
Views: 651
Reputation: 10849
I'd say it is a case where you need to be very careful (this will not delete untracked added files, but will undo any modifying changes or deletions)
git fetch
git reset --hard origin/master
Upvotes: 3