[Cheatsheet] Git

0 minute read

WARNING: This is a personal cheatsheet. Mostly stuff I want to lookup later. You might find more comprehensive ones somewhere else online.

git Client

Initialize a local Client Repository

mkdir a-repository-name cd a-repository-name git init

Initialize a serverside Client Repository

mkdir a-repository-name cd a-repository-name git init –bare

Vital Git Client Config

  • git config –global user.name “John Doe”
  • git config –global user.email “john@doe”
  • git config –global core.editor nvim
  • git config –global init.defaultBranch main

Git Client Commands

  • git clone $REPOSITORY-URL
  • git branch -a
  • git config
  • git log
  • git remote add $REMOTE-NAME $REPOSITORY-URL
  • git log
  • git log –graph
  • git push -u origin master:main

Git Submodules

Git Commit Hooks