Skip to content

Instantly share code, notes, and snippets.

@nasirkhan
Last active May 12, 2022 03:17
Show Gist options
  • Save nasirkhan/5950948 to your computer and use it in GitHub Desktop.
Save nasirkhan/5950948 to your computer and use it in GitHub Desktop.
`git` discard all local changes/commits and pull from upstream

git discard all local changes/commits and pull from upstream

git reset --hard origin/master

git pull origin master

@satheyogesh
Copy link

This really works.

@Plasmoxy
Copy link

thank <3

@marcoris
Copy link

This is so annoying. I read on all pages on the internet the same solution but it don't work. I always have the same modified files after fresh cloning and can't discard them. Even git stash && git stash drop don't work! git checkout -- . does also not work!

@keifgwinn
Copy link

I've had the same, but a git checkout latest --force worked for me

@SugaryChiu
Copy link

Thanks, that does works!

@chococococo
Copy link

Thanks! Worked like a charm

@VitorAugusto
Copy link

lol this one has saved my life and my job, tnx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment