Skip to content

Instantly share code, notes, and snippets.

@dominique-mueller
Last active September 16, 2021 09:00
Show Gist options
  • Save dominique-mueller/aefc21049885accd8ba4ebe48f84ff54 to your computer and use it in GitHub Desktop.
Save dominique-mueller/aefc21049885accd8ba4ebe48f84ff54 to your computer and use it in GitHub Desktop.
Git Cheat Sheet

Revert last commit but keep changes

git reset HEAD^

Note: If alrady pushed to remote, the next push will require --force for overwriting


Cleanup empty folders

git clean -fd
git clean -fdn # dry run

Squash commits

git reset --soft [commit|branch]
# Next, commit and push

Note: If alrady pushed to remote, the next push will require --force for overwriting

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