Git分支:主控与起源/主控与遥控/起源/主控 [英] Git branching: master vs. origin/master vs. remotes/origin/master

查看:112
本文介绍了Git分支:主控与起源/主控与遥控/起源/主控的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我正在理解git的基本概念。



我已经设置并克隆了远程存储库。我还创建了一个服务器端的空存储库,并将我的本地存储库链接到它。



我的问题是我不明白以下区别:




  • origin / master与remotes / origin / master



据我所知, master 是本地分支, remotes / origin / master 是远程分支。



但究竟是 origin / master

解决方案取一个远程仓库的克隆,并运行 git branch -a (以显示git知道的所有分支)。它可能看起来像这样:

  * master 
remotes / origin / HEAD - >原产地/主产地
遥控器/产地/主产地

这里,是本地存储库中的一个分支。 remotes / origin / master 是远程名为 origin master C $ C>。你可以参考这个 origin / master ,如:

  git diff origin / master..master 

您也可以将它称为 remotes / origin / master

  git diff遥控器/ origin / master..master 

这些只是指出同一事物的两种不同方式(顺便说一句,这两个命令的意思是show me远程 master 分支和我的 master 分支之间的更改)。

remotes / origin / HEAD 是远程名为原点的默认分支 。这可以让你简单地说 origin 而不是 origin / master


I think I'm on the right track to understand the basic concepts of git.

I've already set up and cloned a remote repository. I also created a server side empty repository, and linked my local repository to it.

My problem is that I don't understand the difference between:

  • origin/master vs. remotes/origin/master

As far as I have understood, master is a local branch, and remotes/origin/master is a remote one.

But what exactly is origin/master?

解决方案

Take a clone of a remote repository and run git branch -a (to show all the branches git knows about). It will probably look something like this:

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

Here, master is a branch in the local repository. remotes/origin/master is a branch named master on the remote named origin. You can refer to this as either origin/master, as in:

git diff origin/master..master

You can also refer to it as remotes/origin/master:

git diff remotes/origin/master..master

These are just two different ways of referring to the same thing (incidentally, both of these commands mean "show me the changes between the remote master branch and my master branch).

remotes/origin/HEAD is the default branch for the remote named origin. This lets you simply say origin instead of origin/master.

这篇关于Git分支:主控与起源/主控与遥控/起源/主控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆