2013-07-22 7 views
10

私は私の設定では、このセクションで終了する方法(EGitで作成したブランチ、おそらく)わからない:remote =という意味です。 GITの設定で?

[branch "master"] 
    remote = origin 
    merge = refs/heads/master 
[branch "sfc"] 
    remote = . 
    merge = refs/heads/master 
    rebase = true 

私はこれを理解したいと思います。 remote = .のドットがURL(現在のディレクトリ)または特別なリポジトリ名(自分自身へのエイリアス)として解釈されるかどうかはわかりませんか?それは法的/正常/典型的なのでしょうか、それとも私はこれがうんざりしていると思いますか?同じリポジトリを指す「リモート」仕様を持つことは私には奇妙に見えます。さらに、そのブランチは実際にリモートに存在します...プッシュ/プルの動作に関するこれの暗示は何ですか?

いくつかの詳細情報:

$ git remote show origin 
* remote origin 
    Fetch URL: ssh://[email protected]/var/gitrep/zzz.git 
    Push URL: ssh://[email protected]/var/gitrep/zzz.git 
    HEAD branch: master 
    Remote branches: 
    master tracked 
    sfc tracked 
    Local branch configured for 'git pull': 
    master merges with remote master 
    Local refs configured for 'git push': 
    master pushes to master (fast-forwardable) 
    sfc pushes to sfc (up to date) 

$ git branch -vv 
* master  f394d8b [origin/master: ahead 1] Bla blah... 
    sfc  8065309 [master: behind 89] Bla blah... 
+1

あなたの現在のリポジトリを参照していると思います...コミットを作成して '' git fetch sfc''を実行しようとしていますか? –

答えて

4

非常に奇妙です。私は先に進んでダミーのレポを作成し、.git/configをリモートにするように変更しました.、いくつかのコードを追加し、コミットし、プッシュしました。

$ git checkout weird 
$ touch nothing 
$ git add nothing 
$ git commit -a -m "test" 
[sup 031541e] test 
1 file changed, 0 insertions(+), 0 deletions(-) 
create mode 100644 nothing 
$ git push 
fatal: The upstream branch of your current branch does not match 
the name of your current branch. To push to the upstream branch 
on the remote, use 

    git push . HEAD:master 

To push to the branch of the same name on the remote, use 

git push . weird 

$ git push . weird 
Everything up-to-date 

もちろんgitのプッシュの結果は、それが最新のものだと言っていることを意味し、ローカルリポジトリを打っているように見えます。

2

Gitはこれを相対パスとして解決します。../../some/other/repoと同じです。したがって、リポジトリ自体のディレクトリが解決されます。リモートマージターゲットがmasterであるため、sfcがチェックアウトされている間にgit pushが実行されている場合は、mastersfcに早送りしようとします。

あなたが出発点としてリモートブランチを設定し忘れたので、多分それは、あなたがやったことだ

git branch --set-upstream somebranch 

を実行することにより、そのようなブランチを作成することができます。

関連する問題