- 安装后
git config --global user.name “dengyifei”
git config --global user.email "540015260@qq.com"
- junior use
git add file1 file2
git commit -m “提交说明”
- show current workdir status
git status
git diff file
git diff HEAD --file
- history log
git log
git log --pretty=oneline
- return history version
git reset --hard HEAD^
git reset --hard version number
- undo modification
git checkout – file
用版本库里的文件替换工作区git
- SSH
ssh-keygen -t rsa -C "260721762@qq.com"
git remote add origin git@github.com:xxxx/xxxx.git
git push -u origin master
- 分支
git branch
git checkout -b
git branch
git checkout
git branch -d
git push origin --delete
git branch --set-upstream branch-name origin/branch-name
git checkout – file
git checkout -b branch-name origin/branch-name
- 合并
git merge --no-ff -m “”
git log --graph --pretty=oneline --abbrev-commit
- 检出远程分支
git remote -v
git checkout -t origin/hello-edits
- 防止LF换行被替换
git config --global core.autocrlf false