git 创建新分支并推送至远程仓库


1.切换到需要基于变更的主分支

git checkout master

2.创建本地新分支并切换至新分支

git checkout -b new_branch

3.将新建分支推送至远程仓库

git push origin new_branch:new_branch

4.解决报错:当前分支没有跟踪信息。(There is no tracking information for the current branch.)

git branch --set-upstream-to=origin/new_branch

5.删除本地旧的分支,同时删除远程旧的分支

# 删除远程分支: 
git push origin --delete 分支名字

# 删除本地分支: 
git branch -D 分支名字