首页  

git 本地创建新分支并push     所属分类 git 浏览量 727
git branch
* dev3
  master

基于dev3创建新分支 dev3-02
git checkout -b dev3-02
Switched to a new branch 'dev3-02'

或者
git branch dev3-02


git branch -vv
  dev3    1455810 [origin/dev3] add dev3.txt
* dev3-02 1455810 add dev3.txt
  master  ab9a1d5 [origin/master] update


git push
fatal: The current branch dev3-02 has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin dev3-02

push到远程分支(新建远程分支) origin/dev3-02  
git push --set-upstream origin dev3-02
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0

git branch -vv
  dev3    1455810 [origin/dev3] add dev3.txt
* dev3-02 1455810 [origin/dev3-02] add dev3.txt
  master  ab9a1d5 [origin/master] update

新建文件 dev03-02.txt
add commit 并 push


撤销本地分支与远程分支的关联
git branch --unset-upstream
git branch -vv
  dev3    1455810 [origin/dev3] add dev3.txt
* dev3-02 b07bdbb add dev3-02.txt
  master  ab9a1d5 [origin/master] update

git push
fatal: The current branch dev3-02 has no upstream branch.
To push the current branch and set the remote as upstream, use
    git push --set-upstream origin dev3-02
    
将本地分支关联 远程分支 dev3

git branch -u origin/dev3
Branch 'dev3-02' set up to track remote branch 'dev3' from 'origin'.

git branch -vv
  dev3    1455810 [origin/dev3] add dev3.txt
* dev3-02 b07bdbb [origin/dev3: ahead 1] add dev3-02.txt
  master  ab9a1d5 [origin/master] update

git push
fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use
    git push origin HEAD:dev3
    
git push origin HEAD:dev3


git push --set-upstream origin dev3-03
不建议这么玩

上一篇     下一篇
mysql主从复制

MYSQL binlog_format

ElasticJob 简介

容器技术简介

k8s架构简介

k8s本地测试环境搭建工具