尚硅谷面试第一季-13git分支相关命令

课堂重点:分支相关命令

实际应用-工作流程

实操命令及运行结果:

创建master分支并提交

git init

git add .

git commit -m "V1.0"

git remote add origin https://gitee.com/ZhangShunHai/gitbranch.git

git pull origin master --allow-unrelated-histories

git push -u origin master
			

创建feature分支并提交

git checkout -b feature

git add .

git commit -m "个人分支开发"

git pull origin feature

git push origin feature
			

此时feature分支没有与master分支合并,所以

合并feature和master分支

git checkout master

git merge feature

git add .

git commit -m "master 分支合并feature分支"

git pull origin master

git push origin master
			

删除feature分支

git checkout master

git branch -D feature
			

 文件下载:

https://gitee.com/ZhangShunHai/interview_atguigu_seasonone/tree/master/git%E5%88%86%E6%94%AF%E7%9B%B8%E5%85%B3%E5%91%BD%E4%BB%A4

posted @ 2019-03-29 17:32  张顺海  阅读(241)  评论(0编辑  收藏  举报