Git Argument

  • -C run in specific directory git -C ~/.SpaceVim pull
  • -filter
    • The form —filter=blob:none omits all blobs.

push

diff

  • Compare with previous commit: use ^!

    • git diff 77e13ax^!
  • Compare specific directory

    • git diff hash1 hash2 - path/to
  • See the number of changes

    • git diff —stat hash1 hash2
  • See what in staged area

    • git diff —staged
  • hash-object converts an existing file into a git object

  • cat-file prints an existing git object to the standard output.

config

To get all config value, use --list

git config --global gpg.format ssh
pbcopy < ~/.ssh/id_ed25519.pub
git config --global user.signingkey 'key'
git config --global commit.gpgsign true
git config --global tag.gpgsign true
git config --global color.ui auto

To get a particular config value, use --get

  • git config --get --global color.ui

Creating a personal access token - GitHub Docs

  • git config --global credential.helper store

  • git config --global init.defaultBranch main

reset

submodule

git submodule update --init --recursive