Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

git

install

# Arch
sudo Pacman -S git
# Windows 10
scoop install	git

Personal do

# Linux
git config --global core.autocrlf input
# Windows
git config --global core.autocrlf true

usage

config

git config --global user.email "user@email.com"
git config --global user.name "username"

Init

git init
git remote add origin https://github.com/<user>/<repo>
git branch -M main

Push

# git diff
git add <file1> <dir1> <dir2>
# git status
git commit -m "<commit_info>"
# git push -u origin main
git push

Pull

# git pull origin main
git pull

Push tag

# git tag -d v0.0.1
# git push --delete origin v0.0.1
git tag v0.0.1
git push origin v0.0.1

Other

# Undo and re-push
git fetch --all
git reset --hard <commit-hash>
# git reset --hard HEAD~1
git push --force origin <branch>
# Rebase the above 3 commit
git rebase -i HEAD~3
pick <the first commit>
squash <will merge into first commit>
squash <will merge into first commit>

reference

cross-reference

resource

mark

later

cache