Git Sheet

A simple git cheatsheet.

  • list all local branches.
  • list remote and local branches.
  • Create a local branch and switch to it.
  • Switch to an existing branch.
  • Push branch to remote.
  • Rename current branch.
  • Delete a local branch.
  • Delete a remote branch.
  • Print all branches that have been merged into master.

  • Show commit history in single lines.
  • Show commit history for last N commits.
  • Show commit history for last N commits with diff.
  • Show all local file changes in the working tree.
  • Show changes made to a file.
  • Show who changed what & when in a file.
  • Show remote branches and their mapping to local.

  • Delete all untracked files.
  • Delete all untracked files and directories.
  • Undo local modifications to all files.
  • Unstage a file.

  • Get remote tags.
  • Switch to an existing tag.
  • List all tags.
  • Create a new tag.
  • Push all tags to remote repo.

  • Save changes to a stash.
  • List all stashes.
  • Apply a stash and delete it from stash list.
Last Updated: