Git分支管理命令

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从已有分支拉新分支开发

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