1、从远程上clone
git clone https://*******.git
2、添加远程库
git init
git add .
git commit -s
git remote add origin https://******.git
git push -u origin master
在本地新建一个分支: git branch Branch1
切换到你的新分支: git checkout Branch1
将新分支发布在github上: git push origin Branch1
在本地删除一个分支: git branch -d Branch1
在github远程端删除一个分支: git push origin :Branch1 (分支名前的冒号代表删除)
直接使用git pull和git push的设置
git branch --set-upstream-to=origin/master master
git branch --set-upstream-to=origin/ThirdParty ThirdParty
git config --global push.default matching
版本回退
git reset --hard HEAD^
git reset --hard HEAD~1
git reset --hard commit-id
查看工作区和暂存区或版本库区别
git diff //工作区和暂存区区别
git diff HEAD //工作区和当前版本库HEAD指针区别
git diff commit-id //工作区和版本库相应commit-id的区别
git checkout file //撤销工作区修改
git reset HEAD file //撤销添加暂存区