我刚开始使用到位桶,我想我理解了它的结构的问题。
对于我来说,我有一个名为ABC的新的回购协议,我加了一些基本的申请,提交和推送起源大师。 现在最新推的是我的原点/主,对不对?
现在,我想创建一个名为d分支而在它的工作。 当我完成了工作,我犯了,现在我想在逻辑上推这对我的主人。 我不想把它推到原点。 对我来说,它看起来像我不得不推一切的起源,我不明白为什么。 对我来说,原产地就像是一个里程碑,但我想保持原点的第一推我的基本项目的构建。
然后,我将创建一个分支E和它的工作。 最后,我的结构应该是这样的。
这里的小图片希望展示我是怎么想的:
http://s7.postimg.org/k1f5q4b13/git_explanaition.jpg
更新 :对于那些你们谁懂德语https://www.youtube.com/watch?v=0Im_FrvLxXo这也帮助了我很多理解系统。
Your terminology is confusing. You don't push things to branches. You merge things into branches. You push to remotes.
origin
is the name of your remote. In simple terms, that's a repository you have cloned from. Here's an example where there are two remotes:
amb@nimrod-ubuntu:~/git-publish/git-publish$ git remote -v show
github git@github.com:abligh/git-publish.git (fetch)
github git@github.com:abligh/git-publish.git (push)
origin https://github.com/stefanha/git-publish.git (fetch)
origin https://github.com/stefanha/git-publish.git (push)
(don't worry about the separate entries for fetch and push). You can see I cloned stefanha
's github repo called git-publish
, then having made some changes pushed it to my own github repo (same name).
So you merge between your local branches, and push/pull/fetch from remote repositories. A fetch fetches changes from a remote repository, and a pull (roughly) fetches then merges them into a local tracking branch. A push merges your changes to the local copy of the remote repo and pushes your changes to the remote repo.
If you create a new branch D
, and have committed a change set to it, then there are two things you could do with it (well, there are probably more, but let's stick with the obvious):
You could merge the branch D
into your local master. You might or might not then wish to push master to origin.
You could push D
to origin, so origin now has two branches. To do this, the first time you need to tell git where to push, i.e. do git push -u origin D
rather than just git push
. The -u
tells it to track the upstream branch, i.e. pull from there when you next do a git pull
.
I've simplified a bit here, but that's basically it.
你不“推”给师傅,你“合并”。 的“GIT中推”命令是用于发送给同一回购(通常另一台机器上)的另一个克隆,而不是在回购的同一克隆分支之间移动的提交。