zoukankan      html  css  js  c++  java
  • Pro Git-- 跟踪分支

    本地仓库的所有分支可以跟踪远程仓库的远程分支, 这样在当前本地分支上做pull, push时候,可以省略本地分支和远程分支名。

    远程仓库名一般为remote(如果你clone远程仓库时默认设置)或者orgin. 可以使用 git remote add <远程仓库别名> URL 来指定。

     1. 设置 branch tracking, 远程分支foo, 远程仓库名 origin

      git branch -u upstream/foo

    或者如果本地分支不是当前分支,可以:
    git branch -u upstream/foo foo

        以下是两个命令的全写:

    git branch --set-upstream-to=upstream/foo
    git branch --set-upstream-to=upstream/foo foo


    2. 查看追踪分支信息
     a) git branch -vv 跟踪的远程分支显示为蓝色
    [krystal@localhost survey-nodejs]$ git branch -vv
    * login-module 1ab69c5 fix last checkin
      master       1ab69c5 [origin/master] fix last checkin

      b)  使用 git rev-parse --abbrev -ref <分支名>@{upstream}

    [krystal@localhost survey-nodejs]$ git branch -vv
    * login-module 1ab69c5 fix last checkin
      master       1ab69c5 [origin/master] fix last checkin
    

     

      

  • 相关阅读:
    Eclipse 如何安装反编译插件
    java下执行mongodb
    如何利用Xshell在Linux下安装jdk
    asp.net signalR
    手机抓包 fiddler magicwifi
    NServiceBus 消息
    .net 异步函数 Async await
    .net 任务(Task)
    .net 线程基础 ThreadPool 线程池
    .net 序列化反序列化
  • 原文地址:https://www.cnblogs.com/joshuajiang/p/4638357.html
Copyright © 2011-2022 走看看