码迷,mamicode.com
首页 > 其他好文 > 详细

Git分支管理命令

时间:2018-01-11 22:13:30      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:blog   conf   stream   html   out   repo   str   分支管理   www.   

1. 创建新分支

1)创建新仓库

git init
git add README.md
git commit -m "readme.md"
git remote add origin https://github.com/lonelyc/MyRepo.git
git push -u origin master

2)在新的仓库中创建分支

在本地创建新的分支 git branch newbranch
切换到新的分支 git checkout newbranch
将新的分支推送到github git push origin newbranch
在本地删除一个分支: git branch -d newbranch
在github远程端删除一个分支: git push origin :newbranch (分支名前的冒号代表删除)

3)直接使用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

2. git从已有分支拉新分支开发

 

Git分支管理命令

标签:blog   conf   stream   html   out   repo   str   分支管理   www.   

原文地址:https://www.cnblogs.com/yeahwell/p/8270354.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!