zoukankan      html  css  js  c++  java
  • 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# 
  • 相关阅读:
    CSS 透明度 设置 兼容IE FF
    Hibernate学习---第五节:普通组件和动态组件
    Ant学习---第五节:Ant_Junit介绍(基于3的版本)
    Ant学习---第四节:Ant属性的介绍
    Ant学习---第三节:使用Ant实现一个最小的项目编译
    Ant学习---第二节:Ant添加文件夹和文件夹集的使用
    Ant学习---第一节:Ant安装和简单使用
    JPA学习---第十二节:JPA中的联合主键
    JPA学习---第十一节:JPA中的多对多双向关联实体定义与注解设置及操作
    JPA学习---第十节:JPA中的一对一双向关联
  • 原文地址:https://www.cnblogs.com/dream397/p/13753529.html
Copyright © 2011-2022 走看看