Skip to content

Instantly share code, notes, and snippets.

@tonkatsu7
Last active June 26, 2021 14:14
Show Gist options
  • Save tonkatsu7/5992c2cc3be9e36c7f6b43f162115831 to your computer and use it in GitHub Desktop.
Save tonkatsu7/5992c2cc3be9e36c7f6b43f162115831 to your computer and use it in GitHub Desktop.
Remediating diverged branch by abort merge undoing fetched changes and renaming local branch
# abort merge with diverged remote branch
git merge --abort
# https://stackoverflow.com/questions/6591213/how-do-i-rename-a-local-git-branch
# rename local branch
git branch -m tutorial
# https://stackoverflow.com/questions/35591887/how-to-undo-git-fetch
# discard fetched changes
git remote remove origin
# reattach origin
git remote add origin <URI>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment