Skip to content

Instantly share code, notes, and snippets.

@taangle
taangle / git-commands.md
Last active August 1, 2025 19:18
Tips, tricks, and reminders for using git

Configuring git

  • See git config git config --list
  • Set global user name git config --global user.name "<name>"
  • Set global email git config --global user.email "<email>"
  • Configure git to use current branch as default for pushing to origin git config push.default current
  • Create alias for git command git config --global alias.<alias-name> <git-command>
  • Configure git to update branches pointing to rebased commits by default git config --global --add --bool rebase.updateRefs true See more: https://andrewlock.net/working-with-stacked-branches-in-git-is-easier-with-update-refs/

Initializing a repo

  • Initialize .git in existing project git init
  • Initialize bare central repo git init --bare