git push 远程新分支

git clone #从远程克隆

进行一些编辑后

git add .

git commit -m "xxx"

git push #将master推送到master

git checkout -b test #新建test分支

编辑

git add .

git commit -m "xxxx"

git push origin test:haha #将本地test分支推送到远程haha分支

git branch -a

显示如下

  master
* test
  remotes/origin/haha
  remotes/origin/master
git push 时候提醒

获取远程代码修改后,想要push到远端与原来不同的新分支,可以使用下面的命令实现:
git push origin 本地分支:远端希望创建的分支

例如git下来的分支为master

git branch
>>> *master
git push origin master:my_remote_new_branch
#远端即可创建新的分支my_remote_new_branch,提交本地修改


 git push origin :haha #删除远程分支

猜你喜欢

转载自www.cnblogs.com/idyllcheung/p/10651092.html