Skip to content

Instantly share code, notes, and snippets.

@bitliner
Last active October 15, 2020 16:46
Show Gist options
  • Save bitliner/5332eb12762925b23ae7c97f5a5ee25f to your computer and use it in GitHub Desktop.
Save bitliner/5332eb12762925b23ae7c97f5a5ee25f to your computer and use it in GitHub Desktop.

Git

Commit

  • Empty commit git commit --allow-empty -m 'fake commit to push'

Git stash

  • git stash
  • git stash pop - apply last stashed patch
  • git stash show - it makes the list of files of the last stashed patch
  • git stash show -p - it shows the diff of the last stashed patch

Remove history

  • git reset --hard a1b2c3d4
  • git reset --hard HEAD~3 # Go back 3 commits. You will lose uncommitted work

Merge commits

  • git rebase -i HEAD~2 - merge the last 2 commits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment