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# 
  • 相关阅读:
    java+phantomjs实现动态网页抓取
    windows 安装 cordova
    windows系统安装 ionic
    windows系统 安装 mysql.fx
    安装 Navicat for MySQL
    windows 安装 MySQL
    调用百度地图api隐藏版权信息
    ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
    Angular 调用百度地图API接口
    Angular 使用 frame 加载网络资源显示路径不安全问题
  • 原文地址:https://www.cnblogs.com/dream397/p/13753529.html
Copyright © 2011-2022 走看看