git常用命令整理

命令行指令

Git 全局设置
git config --global user.name "light-zhang"
git config --global user.email "34419964@qq.com"
创建新版本库
git clone http://*********/tnwmall/controller-iuser.git
cd controller-iuser
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
已存在的文件夹或 Git 仓库
cd existing_folder
git init
git remote add origin http://*********/tnwmall/controller-iuser.git
git add .
git commit
git push -u origin master

提交注意事项(提交之前去git服务上去合并(pull)一下当前的代码 -f代表强制提交更新 -u代表提交节点代号)
cd existing_folder 
git pull -f origin master
git add . git commit git push -f -u origin master

git创建分支推送(新建分支并推送到git服务 -b代表分支 -f强制)
git checkout -b evaluate-branch 分支名称
git pull -f origin evaluate-branc
分支名称
git add .
git commit
git push -f -u origin evaluate-branch //分支名称
git的master和branch合并(分支和master的合并 -d代表删除)
git merge branch-1 //快速合并
git branch -d branch-1 //删除分支
git branch //查看剩下的分支
git checkout master/branch-1 //切换分支

 
 














 
原文地址:https://www.cnblogs.com/light-zhang/p/8629322.html