Skip to content

Instantly share code, notes, and snippets.

@deepakpk009
Created November 29, 2023 11:51
Show Gist options
  • Save deepakpk009/b1970a5fff31e3a31ff29a502649a7c4 to your computer and use it in GitHub Desktop.
Save deepakpk009/b1970a5fff31e3a31ff29a502649a7c4 to your computer and use it in GitHub Desktop.
How to reset a branch to a commit:
git checkout <branch-name>
git reset --hard <commit-hash>
git push --force origin <branch-name>
Then to check it (it shouldn't print any diff)
git diff <branch-name>..origin/<branch-name>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment