git简单用法

【初始化】
git config --global user.name “P13”
git config --global user.email “公司邮箱”
本地新建[文件夹]作为代码目录
cd [文件夹]
git clone [项目git地址] 
git clone -b [branch name] [项目git地址]
cd [项目]
git branch //查看分支
git branch [branch name] //创建分支
git checkout [branch name] //切换分支


【常规操作】
git branch //查看分支
git merge [other_branch] //合并到当前分支
git fetch //从远程库取回更新
git pull //从远程库取回更新并合并
git add //从修改变为暂存
git commit //从暂存变为提交
git push //提交至远程库


【old】
git checkout [branch name] //切换到develop分支
git pull //从远程库取回更新并合并 远程develop代码更新到本地develop
git checkout [branch name] //切换到本地分支
git merge [branch name] //git merge develop 本地develop代码更新到本地分支


【总结:先更新,再提交代码】
git pull origin [branch name]
git status
git push origin [branch name]

 

posted @ 2019-07-04 15:38  Fourteen  阅读(145)  评论(0编辑  收藏  举报