0

I created a tracking branch so whowasout.com tracked whowasout.com/master

$ git remote -v
origin  git@github.com:venkatd/whowentout.git (fetch)
origin  git@github.com:venkatd/whowentout.git (push)
whowasout.com   git@git01.phpfog.com:whowasout.com (fetch)
whowasout.com   git@git01.phpfog.com:whowasout.com (push)


$ git branch -vv
  master        c33b5dc [origin/master] Merge branch 'whowasout.com'
* whowasout.com 7b6b240 [whowasout.com/master: ahead 1] print statement in test.
php

When I commit some changes in the whowasout.com branch and execute "git push", master gets pushed to origin/master. Is this expected behavior? I was expecting whowasout.com to push to whowasout.com/master.

To push my changes, I currently type "git push whowasout.com whowasout.com:master" but I thought tracking would make this process quicker. Am I on the right track?

4

1 に答える 1

2

あなたはしなければならないでしょう:

git push whowasout.com whowasout.com:master

これは、whowasout.comにはブランチがなくwhowasout.com、必要がないためです。本当に必要なのは、ローカルの whowasout.com ブランチをリモートの whowasout.com の master にプッシュすることです。これは上記のように行う必要があります。

git pushローカルの whowasout.com ブランチからリモートのマスターにプッシュするだけで、必要な動作を得るには、構成push.defaultupstream(以前に呼び出されたtracking)に設定する必要があります。

git config push.default upstream

これを行う必要があることに注意してください。デフォルトでは、ブランチの追跡は、フェッチ/プルを実行しているときに上流のブランチを追跡するのに役立ちます。設定を変更するpush.defaultとプッシュにも反映されます。それ以外の場合、push は一致する参照のみをプッシュします。つまり、whowasout.com ブランチは、リモートの whowasout.com の whowasout.com ブランチにプッシュされます。

于 2012-01-23T17:50:20.573 に答える