我是git的新手,对以下情况感到困惑:
我有一个bitbucket仓库,我在本地克隆它,然后修改并提交,最后推送到远程仓库。如果我进行隐式推送或“push origin”,就没有问题。但如果使用显式的远程地址推送,我会得到状态消息“Your branch is ahead of 'origin/master' by 1 commit”。
看起来Git不认为显式地址和origin是相同的,那么究竟发生了什么呢?如果我再做一次隐式推送,它什么也不会做,但会清除上述消息。
以下是一个示例操作过程:
baz@bhost:/more/coding/git-tests/ask1$ git --version
git version 1.7.2.5
baz@bhost:/more/coding/git-tests$ git clone https://shishani@bitbucket.org/shishani/dirasi.git ask1
Cloning into ask1...
Password:
remote: Counting objects: 24054, done.
remote: Compressing objects: 100% (6300/6300), done.
remote: Total 24054 (delta 17124), reused 24024 (delta 17106)
Receiving objects: 100% (24054/24054), 11.83 MiB | 251 KiB/s, done.
Resolving deltas: 100% (17124/17124), done.
baz@bhost:/more/coding/git-tests$ cd ask1
baz@bhost:/more/coding/git-tests/ask1$ jed setup.py
baz@bhost:/more/coding/git-tests/ask1$ git commit -a
[master a053f28] modified: setup.py
1 files changed, 1 insertions(+), 0 deletions(-)
baz@bhost:/more/coding/git-tests/ask1$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
baz@bhost:/more/coding/git-tests/ask1$ git remote show origin
Password:
* remote origin
Fetch URL: https://shishani@bitbucket.org/shishani/dirasi.git
Push URL: https://shishani@bitbucket.org/shishani/dirasi.git
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (fast-forwardable)
baz@bhost:/more/coding/git-tests/ask1$ git push
Password:
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 314 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: bb/acl: shishani is allowed. accepted payload.
To https://shishani@bitbucket.org/shishani/dirasi.git
5e9ffd1..a053f28 master -> master
baz@bhost:/more/coding/git-tests/ask1$ git status
# On branch master
nothing to commit (working directory clean)
baz@bhost:/more/coding/git-tests/ask1$ jed setup.py
baz@bhost:/more/coding/git-tests/ask1$ git commit -a
[master 6d0e236] modified: setup.py
1 files changed, 1 insertions(+), 0 deletions(-)
baz@bhost:/more/coding/git-tests/ask1$ git push https://shishani@bitbucket.org/shishani/dirasi.git master
Password:
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 298 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: bb/acl: shishani is allowed. accepted payload.
To https://shishani@bitbucket.org/shishani/dirasi.git
a053f28..6d0e236 master -> master
baz@bhost:/more/coding/git-tests/ask1$ git status
# On branch master
**# Your branch is ahead of 'origin/master' by 1 commit.** <-- this does not reflect current state
#
nothing to commit (working directory clean)
baz@bhost:/more/coding/git-tests/ask1$ git push
Password:
Everything up-to-date
baz@bhost:/more/coding/git-tests/ask1$ git status
# On branch master
nothing to commit (working directory clean)