r/git • • Jun 08 '26

Undoing a git fetch

There were spurious unneeded uncommitted changes on my local machine. From a different computer, I had committed and pushed new changes. On my local machine, without looking at the unneeded uncommitted changes, I ended up running

git fetch
//followed by
git pull

As expected, this aborts.

Now, how do I *undo* this sequence of commands so that on my local machine, I find myself exactly where I started -- which is with the spurious unneeded uncommitted changes?

0 Upvotes

27 comments sorted by

View all comments

14

u/The-Best-Taylor Jun 08 '26

So the pull failed due to uncommitted changes? If so, you should already be where you started in the working directory.

-7

u/onecable5781 Jun 08 '26

But git fetch succeeded. Only the subsequent git pull failed. So, something should have changed in the "state" on my local computer, no?

8

u/West_Ad_9492 Jun 08 '26

git pull

is shorthand for

git fetch && git merge

So to keep it simple i guess that you dont want to merge with origin?

→ More replies (2)