Git cheatsheet

Flow

1
2
[Working directory] -> [Staging Area (Index)] -> [Repository] -> [Remote]
                   add                      commit           push

Basic

Stash & Patch

Info

Merge

Revert

Tags

Submodules

Remove submodule

  1. git rm [submodule]
  2. rm -rf .git/modules/[submodule]
  3. git config --remove-section submodule.[submodule]
  4. git commit

Binary files - LFS (Large File Storage)

  1. git lfs install : install LFS, once per user
  2. git lfs track "*.[file type]" : add file type to track with LFS
  3. git add .gitattributes : make sure that this is tracked

Config

1
2
3
4
5
6
7
8
9
[user]
    name = [FIRST NAME] [LAST NAME]
    email = [EMAIL]
[credential]
    helper = store
[log]
    date = local
[format]
    pretty = format:%C(yellow)%h %Cblue%>(12)%ad %Cgreen%<(7)%aN%Cred%d %Creset%s

GitHub password

GitHub is no longer accepting account passwords, need to use PAT (Personal Access Token).