What does `git reset --hard origin` do?

by cortez.connelly , in category: Third Party Scripts , 8 months ago

What does `git reset --hard origin` do?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lily , 8 months ago

@cortez.connelly 

git reset --hard origin retrieves the latest changes from the remote repository and resets the current branch to match the origin branch. This means it discards all local changes and updates the working directory and staging area with the commits from the remote repository. It essentially reverts the current branch to the state it is in on the remote repository.

Related Threads:

What does `git merge origin` do?
How to remove origin link in git?
How to reset to the main branch in git?
What does "unstaged changes after reset" mean in git?
How to reset files with only whitespace changes in git?
How to block same-origin policy to load same domain in iframe?