Git - 你的分支领先于5次提交

时间:2016-02-11 11:29:08

标签: git

在我的git repo中,除了master之外还有两个分支。 nyteamcfteam

切换到nyteam分支

提交一些更改并推送到origin/nyteam (到目前为止只推送了一个提交)

切换到cfteam

git status
Your branch is up-to-date with 'origin/cfteam'

git pull origin nyteam
git status

Your branch is ahead of 'origin/cfteam' by 5 commits.

现在问题是,其他四个提交到哪里实际上并没有由我完成。

任何人都可以解释这种情况吗?

2 个答案:

答案 0 :(得分:2)

  

现在问题是,其他四个提交到哪里实际上并没有由我完成。

为了查看历史记录,请执行以下操作:

git log --oneline --decorate --graph

它将显示分支指向的提交。

其他四个提交来自哪里?

执行时:

git pull origin nyteam

nyteam在您当前的分支cfteam中添加了4次提交,所以现在您有来自合并分支的提交。

以下是类似的示例:

enter image description here

git log after the merge (pull = fetch + merge)

enter image description here

答案 1 :(得分:1)

这两个分支在过去的某个点上分道扬..对nyteam的更改由四个提交表示。当你从cfteam拉到nyteam时,它已经将新的更改合并到前四次提交到达的状态。所以第五个节点是合并,之前的四个是该分支的变化。你是“领先”因为你有cfteam作为nyteam跟踪的起源。