2013-03-25 15 views
6

Onestamente non riesco a trovare alcuna documentazione dettagliata della produzione di git remote show (non certo sulla man page)spiegazione dettagliata di 'show remoto git'

In particolare, una chiara spiegazione esatta delle Local sezioni sarebbe apprezzato.

Un esempio di quello che trovo confuso:

Qui ho due telecomandi, Klas e origine e l'uscita che producono:

> git remote show klas 
* remote klas 
    Fetch URL: ..\klasrepo 
    Push URL: ..\klasrepo 
    HEAD branch: master 
    Remote branches: 
    experiment tracked 
    feature  tracked 
    master  tracked 
    pu   tracked 
    stashbranch tracked 
    Local branch configured for 'git pull': 
    pu merges with remote pu 
    Local refs configured for 'git push': 
    experiment pushes to experiment (fast-forwardable) 
    feature pushes to feature (fast-forwardable) 
    master  pushes to master  (fast-forwardable) 
    pu   pushes to pu   (up to date) 
> git remote show origin 
* remote origin 
    Fetch URL: C:/Temp/git/.\barerepo.git 
    Push URL: C:/Temp/git/.\barerepo.git 
    HEAD branch: experiment 
    Remote branches: 
    experiment tracked 
    master  tracked 
    Local branches configured for 'git pull': 
    experiment merges with remote experiment 
    master  rebases onto remote master 
    Local refs configured for 'git push': 
    experiment pushes to experiment (up to date) 
    master  pushes to master  (fast-forwardable) 

noti che esperimento e maestro sono elencati in entrambilocal refs configured for 'git push'. Cosa significa? Ho configurato maestro e esperimento per tenere traccia origin/master e origine/rispettivamente esperimento (e pu per monitorare Klas/PU).

mio locale funzione ramo non è configurato per monitorare qualsiasi cosa, ma è ancora elencato sotto local refs configured for 'git push' (l'unico collegamento sembra essere il nome identico, un altro-tracking non ramo, foo, non è menzionato). git push mentre su la funzione fornisce fatal: The current branch feature has no upstream branch. - difficilmente "inoltro veloce".

Sembra che i criteri per un ramo locale elencato in local refs configured for 'git push' è che esiste un ramo remoto con lo stesso nome ??

Per riferimento:

> git branch -vva 
    experiment    0cf7b2a [origin/experiment] added rand content 82 to .\rand_content.txt 
* feature     4b25f46 added rand content 62 to bar.txt 
    foo      40aee50 added rand content 17 to .\rand_content.txt 
    master     4b25f46 [origin/master] added rand content 62 to bar.txt 
    pu      44ad10b [klas/pu] added rand content 51 to doo.txt 
    remotes/klas/experiment 1f4e89b app 
    remotes/klas/feature  884e953 added rand content 80 to bar.txt 
    remotes/klas/master  57877c1 added in tobias repo 
    remotes/klas/pu   44ad10b added rand content 51 to doo.txt 
    remotes/klas/stashbranch 8678cf0 added rand content 44 to .\rand_content.txt 
    remotes/origin/HEAD  -> origin/master 
    remotes/origin/experiment 0cf7b2a added rand content 82 to .\rand_content.txt 
    remotes/origin/master  4b25f46 added rand content 62 to bar.txt 
> git config --list --local | select-string 'branch|remote' 
remote.origin.url=C:/Temp/git/.\barerepo.git 
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* 
branch.master.remote=origin 
branch.master.merge=refs/heads/master 
branch.master.rebase=true 
remote.klas.url=..\klasrepo 
remote.klas.fetch=+refs/heads/*:refs/remotes/klas/* 
branch.experiment.remote=origin 
branch.experiment.merge=refs/heads/experiment 
branch.pu.remote=klas 
branch.pu.merge=refs/heads/pu 
> git --version 
git version 1.8.1.msysgit.1 

risposta

4

Questo sembra essere un bug in Git 1.8.1.

Scorrendo il codice Git sorgente (specificamente remote.c e builtin/remote.c), la lista sotto "arbitri locali configurati per 'push git'" viene calcolato come segue:

refspecs spinta
  1. raccolga configurata:
    • lettura .git/remotes/<remotename> (un file di configurazione obsoleto; vedi git help repository-layout)
    • leggere .git/branches/<branchname> (un altro file di configurazione obsoleto)
    • esaminare il 0.123.config voce
  2. se passo # 1 non ha trovato nulla, utilizzare : come l'unica spinta refspec
  3. trovare tutti {,} remoti locali combinazioni filiali che hanno abbinato i refspecs spinta raccolti

Si noti che l'algoritmo di cui sopra non presta attenzione a branch.<branchname>.remote, branch.<branchname>.merge o push.default.

In modelli di utilizzo tipici, il passaggio n. 1 dell'algoritmo precedente non troverà mai alcun refspec configurato in modo da utilizzare :. Questo refspec è un refspec di adattamento semplice, quindi con l'utilizzo tipico git remote show <remotename> verrà sempre stampato <branchname> pushes to <branchname> se c'è un ramo denominato <branchname> in entrambi i repository locali e remoti.

Problemi correlati