Nick
Nick

Reputation: 3090

How to undo the changes I made in a git branch?

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:

How can I fully undo the changes/deleted files I made in the 'newbranche' branch?

Upvotes: 1

Views: 651

Answers (1)

axelduch
axelduch

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

Related Questions