2013-06-11 12 views
15

Mam repozytorium, które śledzi inne niż domyślne gałęzie. Tak więc istnieje lokalny oddział o nazwie "master", który powinien śledzić "origin/master-13.07". Zrobiłem "push -u" i uważam, że powinno wystarczyć, że oddział jest śledzony. Wyjście git branch -vv:gałąź git track z inną nazwą

C:\work\repo>git branch -vv 
    stuff  68792df [origin/stuff-13.07] Small bugfix 
* master 68792df [origin/master-13.07: ahead 1] Small bugfix 

wyjście git status

C:\work\repo>git status 
# On branch master 
# Your branch is ahead of 'origin/master-13.07' by 1 commit. 
# (use "git push" to publish your local commits) 
# 
nothing to commit, working directory clean 

wszystko wydaje się w porządku, ale kiedy tylko używać "git push" (jak git zaleca mi powyżej), to nie:

C:\work\repo>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 origin HEAD:master-13.07 

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

    git push origin master 

Tak, wiem, że nazwa nie pasuje, to jest dokładnie to, czego chcę, a ja powiedziałem, żeby poszło przez "push -u". Dlaczego nie mogę po prostu użyć "push"?

C:\work\repo>git --version 
git version 1.8.3.msysgit.0 

C:\work\repo>git config push.default 
simple 
+0

Którą wersję Git używasz? Czy ustawiłeś opcję 'push.default'? –

+0

@GuillaumeDarmont Dodałem informacje na pytanie – kan

+0

@GuillaumeDarmont Wydaje się, że rozwiązaniem jest zmiana 'push.default' na' upstream'. Dzięki. – kan

Odpowiedz

16

Ok. Dzięki dodanym informacjom, po prostu trzeba zmienić push.default na wartość upstream.

Prawdopodobnie skonfigurowany rzeczywistą wartość po aktualizacji Git i widząc tę ​​wiadomość:

warning: push.default is unset; its implicit value is changing in 
Git 2.0 from 'matching' to 'simple'. To squelch this message 
and maintain the current behavior after the default changes, use: 

    git config --global push.default matching 

To squelch this message and adopt the new behavior now, use: 

    git config --global push.default simple 

Zgodnie z dokumentacją, wartość simple musi odrzucić push gdy nazwy oddziałów są różne. Zobacz Git Config (wyszukaj push.default).

Powiązane problemy