使用ssh-key
ssh-keygen -t rsa -C 'email'
cat ~/.ssh/id_rsa.pub
pbcopy < ~/.ssh/id_rsa.pub
cat ~/.ssh/id_rsa.pub | clip || type %userprofile%\.ssh\id_rsa.pub | clip
xclip -sel clib < ~/.ssh/id_rsa.pub
仓库管理
mkdir repository
cd repository
git init
git remote add origin url
git push -u origin master
从远程仓库克隆项目
git clone url
操作版本库
touch README.md
git add README.md
git commit -m '描述'
git push
分支管理
git checkout -b dev || git switch -c dev
git branch
git push -u origin branchName
git switch master
git merge dev || git rebase dev
git branch -d branchName
git branch -r -d origin/branchName
git push origin :branchName
git小技巧
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.type 'cat-file -t'
git config --global alias.dump 'cat-file -p'
git config --global alias.stage 'add .'
git config --global alias.s 'switch'
git config --global alias.sc 'switch -c'
git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
git config --global alias.ls 'log --pretty=format:"%h %ad | %C(yellow)%h%Cred%d\ %Creset%s%Cblue\ [%cn]" --decorate'
git config --global alias.ll 'log --pretty=format:"%h %ad | %C(yellow)%h%Cred%d\ %Creset%s%Cblue\ [%cn]" --decorate --numstat'
git config --global alias.lg "log --color --graph --pretty=format:'%h %ad | %Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global color.ui auto
git config --global pager.branch false
git config --global --replace—=all core.pager cat
git config --global core.ignorecase false
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive atuo
git config --global credential.helper store