Github配置
- 添加SSH key
- gen key: - ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- copy pub key to Github profile: pbcopy < ~/.ssh/id_rsa.pub
- test: ssh -T git@github.com
Github上同步fork和orignal
同步master
- git remote -v
- git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
- git remote -v
- git fetch upstream
- git checkout master
- git merge upstream/master
同步branch
- git checkout upstream/{branch}
- git checkout -b {local_branch}
- git merge upstream/{branch} {local_branch}
命令别名
https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
- git config --global alias.co checkout
- git config --global alias.br branch
- git config --global alias.ci commit
- git config --global alias.st status
杂
- git reset --hard origin/master: 恢复到origin/master
- git config --global credential.helper wincred: 缓存用账号,避免push时每次输入(用https地址clone,每次都要求输入账号)
- git config --global core.autocrlf true: 去除mac os和windows换行符的diff (http://stackoverflow.com/questions/1889559/git-diff-to-ignore-m)
- git config core.filemode false: 去除old and new mode diff (http://stackoverflow.com/questions/1257592/how-do-i-remove-files-saying-old-mode-100755-new-mode-100644-from-unstaged-cha)