zoukankan      html  css  js  c++  java
  • Git命令

    git branch --set-upstream-to=origin/<branch> xxx_api3.1_xxx
    error: the requested upstream branch 'origin/xxx_api3.1_xxx' does not exist
    hint: 
    hint: If you are planning on basing your work on an upstream
    hint: branch that already exists at the remote, you may need to
    hint: run "git fetch" to retrieve it.
    hint: 
    hint: If you are planning to push out a new local branch that
    hint: will track its remote counterpart, you may want to use
    hint: "git push -u" to set the upstream config as you push.
    git push -u
    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:xxx_api3.1
    
    To push to the branch of the same name on the remote, use
    
        git push origin xxx_api3.1_xxx
    git push origin xxx_api3.1_xxx
    Total 0 (delta 0), reused 0 (delta 0)
    To git@gitlab.ooo.cn:app/zzz-xxx.git
     * [new branch]      xxx_api3.1_xxx -> xxx_api3.1_xxx

    1 查看远程分支

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    $ git branch -a
     
    * br-2.1.2.2
     
    master
     
    remotes/origin/HEAD -> origin/master
     
    remotes/origin/br-2.1.2.1
     
    remotes/origin/br-2.1.2.2
     
    remotes/origin/br-2.1.3
     
    remotes/origin/master

    2 查看本地分支

    1
    2
    3
    4
    5
    $ git branch
     
    * br-2.1.2.2
     
    master

    3 创建分支

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
     
    $ git branch test
     
    $ git branch
     
    * br-2.1.2.2
     
    master
     
    test

    4 切换分支到test

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
     
    $ git branch
     
    * br-2.1.2.2
     
    master
     
    test
     
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
     
    $ git checkout test
     
    M jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.java
     
    M jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.java
     
    Switched to branch 'test'
     
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (test)
     
    $ git branch
     
    br-2.1.2.2
     
    master
     
    test

    5 删除本地分支   git branch -d xxxxx

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    $ git checkout br-2.1.2.2
     
    M jingwei-server/src/main/java/com/taobao/jingwei/server/service/cmd/GetCustomerTarCmd.java
     
    M jingwei-server/src/main/java/com/taobao/jingwei/server/util/ServerUtil.java
     
    Switched to branch 'br-2.1.2.2'
     
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
     
    $ git br
     
    * br-2.1.2.2
     
    master
     
    test
     
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
     
    $ git br -d test
     
    Deleted branch test (was 17d28d9).
     
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (br-2.1.2.2)
     
    $ git br
     
    * br-2.1.2.2
     
    master

    6 查看本地和远程分支  -a。前面带*号的代表你当前工作目录所处的分支

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    shuohailhl@SHUOHAILHL-PC /f/ggg/jingwei (test)
     
    $ git branch -a
     
    br-2.1.2.2
     
    master
     
    test
     
    remotes/origin/HEAD -> origin/master
     
    remotes/origin/br-2.1.2.1
     
    remotes/origin/br-2.1.2.2
     
    remotes/origin/br-2.1.3
     
    remotes/origin/master

     

  • 相关阅读:
    轻松实现内容的无缝平滑滚动
    世界“新七大奇迹”揭晓 中国长城成功入选
    Blog_Backup:绿色博客备份工具
    【Vista中系统准备工具存在隐患,自动清除用户资料】
    Oracle大连全球支持中心运营就在我们公司前面!
    ASP.NET2.0下使用AJAX调用Webservice的方法
    配合AJAX天气预报的WebService
    Google兑现承诺你可以从google上删除你的搜索记录了
    全体注意:@live.com 形势不妙,可能三周内被收回
    国内软件联盟抨击微软以非正规手段推文档标准
  • 原文地址:https://www.cnblogs.com/exmyth/p/6392926.html
Copyright © 2011-2022 走看看