6

我正在使用两个分支testmain

所以,在分支上,我做了:

git merge test

一切都很顺利。所有更改都已合并。

然后将其推送到远程主服务器,我做了:

git push

但它似乎什么也没做,它说:

Total 0 (delta 0), reused 0 (delta 0)
To git@github.com:Company/My-App.git
b878c9d..0dc7fbe  main -> main

如果推送确实顺利进行,我认为它不应该在 Total 上面显示为零。

如何推送我的分支?

4

1 回答 1

5

这只是意味着 git 不写任何对象。当所有对象都已经在远程并且合并时,您只需将标签“main”移动到最新提交,就会发生这种情况。我只是做了一个快速测试来证明:

    ~/workspace
    $ git clone git@github.com:korin/test_merge.git
    Cloning into 'test_merge'...
    remote: Counting objects: 3, done.
    remote: Total 3 (delta 0), reused 0 (delta 0)
    Receiving objects: 100% (3/3), done.

    ~/workspace
    $ cd test_merge
    ~/workspace/test_merge

    $ git co -b test
    Switched to a new branch 'test'

    ~/workspace/test_merge
    $ echo 'a' > a

    ~/workspace/test_merge
    $ git add .

    ~/workspace/test_merge
    $ git ci -m 'a'
    [test 9953350] a
     1 file changed, 1 insertion(+)
     create mode 100644 a

    ~/workspace/test_merge
    $ git push --set-upstream origin test
    Counting objects: 4, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 273 bytes, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To git@github.com:korin/test_merge.git
     * [new branch]      test -> test
    Branch test set up to track remote branch test from origin.

    ~/workspace/test_merge
    $ g co master
    Switched to branch 'master'

    ~/workspace/test_merge
    $ g merge test
    Updating f5e0184..9953350
    Fast-forward
     a |    1 +
     1 file changed, 1 insertion(+)
     create mode 100644 a

    ~/workspace/test_merge
    $ g push
    Total 0 (delta 0), reused 0 (delta 0)
    To git@github.com:korin/test_merge.git
         f5e0184..9953350  master -> master
于 2012-07-19T19:33:10.380 回答