2014-09-25 30 views
1

我對git的狀態此消息:git的狀態:上分行XXX你的分支是提前10原產/ YYY的承諾

# On branch YYY 
# Your branch is ahead of 'origin/XXX' by 10 commits. 
# 
nothing to commit (working directory clean) 

科YYY是分支XXX的孩子。但通常在git狀態,我會預計:

# On branch YYY 
# Your branch is ahead of 'origin/YYY' by 10 commits. 
# 
nothing to commit (working directory clean) 

Git fetch並不能解決問題。 任何想法? (過濾後)的git branch -avvv

輸出:

* XXX        0d64037 [origin/YYY: ahead 10] test 
    remotes/origin/XXX    0d64037 test 

回答

1

檢查的git branch -avvv

也許YYY輸出已經被設置爲跟蹤origin/XXX

你可以改變它:

git branch branch_name -u your_new_remote/branch_name 
git branch YYY -u origin/YYY 

# for git older than 1.8 
git branch YYY --set-upstream origin/YYY 

您將需要推YYY至少一次,在git status輸出看到約origin/YYY任何東西之前。

+0

找不到--u選項 – albanx 2014-09-25 08:30:23

+0

好的我解決了:git branch XXX --set-upstream origin/YYY然後我按照你的建議推送了。你可以添加這個答案。謝謝。 – albanx 2014-09-25 08:35:58

+0

@albanx偉大。 '-u'適用於git 1.8或更高版本(請參閱http://stackoverflow.com/a/4879224/6309) – VonC 2014-09-25 08:37:07