Skip to content

Instantly share code, notes, and snippets.

@alebaffa
Last active November 30, 2023 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alebaffa/cd61f177a79a4d857bcc55ba7c535f3a to your computer and use it in GitHub Desktop.
Save alebaffa/cd61f177a79a4d857bcc55ba7c535f3a to your computer and use it in GitHub Desktop.
Git squash alternatives

Git Squash alternatives:

  • git rebase -i HEAD~X - this allows you to merge interactively several commits
    • then fixup OR pick OR reword AND push --force
  • git reset --hard HEAD~X - this rollbacks the index back to X commits (check git status before doing this. Commit first)
    • commit again using just one commit
  • git reset --hard COMMIT_ID - this rollbacks the index back to the commit_id
@uyilmaz
Copy link

uyilmaz commented Nov 30, 2023

Does the second method work when changes are already pushed to the remote?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment