• Git


    新建一个本地分支,将一个远程分支 checkout 到新建的那个本地分支。

    $ git chekcout -b <local-branch-name> <remote-name>/<remote-branch-name>
    Branch '<local-branch-name>' set up to track remote branch '<remote-name>' from '<remote-branch-name>'.
    Switched to a new branch '<local-branch-name>'
    

    注意:<local-branch-name> 必须是新的本地分支,不能和已有的本地分支同名。

    如果你指定的 <local-branch-name><remote-branch-name> 相同,则可简写为

    git checkout --track <remote-name>/<remote-branch-name>

    其中 --track 可简写为 -t

    git push

    $ 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 <remote-name> HEAD:master
    
    To push to the branch of the same name on the remote, use
    
        git push <remote-name> HEAD
    
    To choose either option permanently, see push.default in 'git help config'.
    
    $ git push -u origin master
    Enumerating objects: 3, done.
    Counting objects: 100% (3/3), done.
    Writing objects: 100% (3/3), 231 bytes | 231.00 KiB/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To github.com/uname/reponame.git
     * [new branch]      master -> master
    Branch 'master' set up to track remote branch 'master' from 'origin'.
    

    Local branch 'master' set up to track remote branch 'master' from 'origin'.

    $ git merge --allow-unrelated-histories master
    Auto-merging README.md
    CONFLICT (add/add): Merge conflict in README.md
    Automatic merge failed; fix conflicts and then commit the result.
    

    References

    Squash several Git commits into a single commit

    How can I tell a local branch to track a remote branch?

    Git远程操作详解

  • 相关阅读:
    redis搭建集群
    redis搭建主从
    redis与python交互
    redis数据操作篇
    redis配置篇
    node 淘宝镜像
    java 深copy
    springmvc配置访问静态文件
    centos 启动 oracle
    List 分隔多次执行 且在同一个事物当中
  • 原文地址:https://www.cnblogs.com/Patt/p/11335292.html
Copyright © 2020-2023  润新知