Created
November 30, 2018 18:53
-
-
Save JamesKontargyris/360ec1668647195ba2ef874d42b79f0c to your computer and use it in GitHub Desktop.
Git: fetch remote branch and force hard reset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git fetch --all | |
git reset --hard origin/master | |
OR If you are on some other branch | |
git reset --hard origin/your_branch | |
Explanation: | |
git fetch downloads the latest from remote without trying to merge or rebase anything. | |
Then the git reset resets the master branch to what you just fetched. The --hard option changes all the files in your working tree to match the files in origin/master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment