测试环境
U12.04
git version 1.7.9.5
测试步骤
我clone了一个远程仓库
git branch -r
origin/master
origin/test1
git checkout -b test1test origin/test1
在本地建立一个分支test1test跟踪远程的分支test1
git branch
master
test1
* test1test
git config -l
(前面略)....
branch.test1test.remote=origin
branch.test1test.merge=refs/heads/test1
这时问题来了,我做了几个修改,明明看起来是跟踪远程分支了,但是push不上去
echo hello2 > test1
git add test1 && git commit -m "hello2" && git push
[test1test f4db248] hello2
1 file changed, 1 insertion(+), 1 deletion(-)
Everything up-to-date
git status
# On branch test1test
# Your branch is ahead of 'origin/test1' by 1 commit.
#
nothing to commit (working directory clean)
再来一次
echo hello3 > test1 && git add test1 && git commit -m "hello3" && git push
[test1test 1baa86d] hello3
1 file changed, 1 insertion(+), 1 deletion(-)
Everything up-to-date
git status
# On branch test1test
# Your branch is ahead of 'origin/test1' by 2 commits.
#
nothing to commit (working directory clean)