• git切换分支


    root@ubuntu:~/kata/qemu# git branch
    * master
    root@ubuntu:~/kata/qemu# git branch all
    root@ubuntu:~/kata/qemu# git branch --all
      all
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
      remotes/origin/stable-0.10
      remotes/origin/stable-0.11
      remotes/origin/stable-0.12
      remotes/origin/stable-0.13
      remotes/origin/stable-0.14
      remotes/origin/stable-0.15
      remotes/origin/stable-1.0
      remotes/origin/stable-1.1
      remotes/origin/stable-1.2
      remotes/origin/stable-1.3
      remotes/origin/stable-1.4
      remotes/origin/stable-1.5
      remotes/origin/stable-1.6
      remotes/origin/stable-1.7
      remotes/origin/stable-2.0
      remotes/origin/stable-2.1
      remotes/origin/stable-2.10
      remotes/origin/stable-2.11
      remotes/origin/stable-2.12
      remotes/origin/stable-2.2
      remotes/origin/stable-2.3
      remotes/origin/stable-2.4
      remotes/origin/stable-2.5
      remotes/origin/stable-2.6
      remotes/origin/stable-2.7
      remotes/origin/stable-2.8
      remotes/origin/stable-2.9
    root@ubuntu:~/kata/qemu# git checkout  remotes/origin/stable-4.0
    Checking out files: 100% (6577/6577), done.
    Note: checking out 'remotes/origin/stable-4.0'.
    
    You are in 'detached HEAD' state. You can look around, make experimental
    changes and commit them, and you can discard any commits you make in this
    state without impacting any branches by performing another checkout.
    
    If you want to create a new branch to retain commits you create, you may
    do so (now or later) by using -b with the checkout command again. Example:
    
      git checkout -b <new-branch-name>
    
    HEAD is now at 23967e5b2a Update version for 4.0.1 release
    root@ubuntu:~/kata/qemu# 
    1. 找一个干净目录,假设是git_work
    2. cd git_work
    3. git clone http://myrepo.xxx.com/project/.git #这样在git_work目录下得到一个project子目录
    4. cd project
    5. git branch -a,
    '''列出所有分支名称如下:
    remotes/origin/dev
    remotes/origin/release'''
    6. git checkout -b dev origin/dev  #作用是checkout远程的dev分支,在本地起名为dev分支,并切换到本地的dev分支
    7. git checkout -b release origin/release  #checkout远程的release分支,在本地起名为release分支,并切换到本地的release分支
    8. git checkout dev  #切换回dev分支,并开始开发
    root@ubuntu:/opt/gopath/src/github.com/kubeedge/kubeedge# git branch -a
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/master
      remotes/origin/release-0.3
      remotes/origin/release-1.0
      remotes/origin/release-1.1
      remotes/origin/release-1.2
      remotes/origin/release-1.3
      remotes/origin/release-1.4
      remotes/origin/release-1.5
      remotes/origin/release-1.6
    root@ubuntu:/opt/gopath/src/github.com/kubeedge/kubeedge# git branch
    * master
    root@ubuntu:/opt/gopath/src/github.com/kubeedge/kubeedge# git checkout -b release-1.4 remotes/origin/release-1.4
    M       build/tools/certgen.sh
    Branch 'release-1.4' set up to track remote branch 'release-1.4' from 'origin'.
    Switched to a new branch 'release-1.4'
    root@ubuntu:/opt/gopath/src/github.com/kubeedge/kubeedge# git branch
      master
    * release-1.4
    root@ubuntu:/opt/gopath/src/github.com/kubeedge/kubeedge# 
  • 相关阅读:
    spring bean的作用域
    Web前端开发CSS规范总结
    前端技术都包含哪些?
    Web安全常见问题及解决方法
    如何让手游更省带宽,耗电量更少?TBR渲染架构解析!
    新手学Java,有哪些入门知识点?
    如何让手游内存占用更小?从内存消耗iOS实时统计开始
    动作游戏老是卡?试试从这些方面提升流畅度
    开发者必知!2020年大前端发展趋势解读
    游戏编程入门! 想成为专业的游戏开发程序员需要掌握哪些?
  • 原文地址:https://www.cnblogs.com/dream397/p/13753529.html
Copyright © 2020-2023  润新知