Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
`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

@kpit-nrangavkar

This comment has been minimized.

Copy link

kpit-nrangavkar commented Jun 12, 2017

Its worked for me

git reset --hard origin/[your master branch name]

git pull origin [your master branch name]

Thank You

@satheyogesh

This comment has been minimized.

Copy link

satheyogesh commented May 25, 2018

This really works.

@Plasmoxy

This comment has been minimized.

Copy link

Plasmoxy commented Jul 16, 2018

thank <3

@marcoris

This comment has been minimized.

Copy link

marcoris commented Nov 29, 2018

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

This comment has been minimized.

Copy link

keifgwinn commented Mar 28, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.