Se facciogit tracking non funziona con diversi nomi locali e remoti?
git checkout -b samename origin/samename
poi il monitoraggio sembra funzionare bene. Se eseguo i commit successivi, posso quindi fare
git push
e git ha spinto verso l'alto i miei commit all'origine.
Tuttavia, se faccio
git checkout -b diffname origin/samename
poi il monitoraggio non funziona, nonostante questa sezione del libro pro git:
$ git checkout -b sf origin/serverfix
Branch sf set up to track remote branch refs/remotes/origin/serverfix.
Switched to a new branch "sf"
Now, your local branch sf will automatically push to and pull from origin/serverfix
git push solo dà 'tutto aggiornato' Cosa dà?
Sono in esecuzione git 1.7.1 su Mac OS X
Ecco l'intero esperimento per coloro che vogliono provare a casa:
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git add file1
szbwood-mbp15:proj4_local bwood$ git commit -m"Created file 1"
[master (root-commit) 5d50289] Created file 1
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file1
szbwood-mbp15:proj4_local bwood$ git push origin master:samename
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/bwood/work/gitplay/proj4_remote.git
* [new branch] master -> samename
szbwood-mbp15:proj4_local bwood$ git checkout -b samename origin/samename
Branch samename set up to track remote branch samename from origin.
Switched to a new branch 'samename'
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git commit -a
[samename a7af908] ..
1 files changed, 1 insertions(+), 0 deletions(-)
szbwood-mbp15:proj4_local bwood$ git push
Counting objects: 5, done.
Writing objects: 100% (3/3), 251 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/bwood/work/gitplay/proj4_remote.git
5d50289..a7af908 samename -> samename
szbwood-mbp15:proj4_local bwood$ git checkout -b diffname origin/samename
Branch diffname set up to track remote branch samename from origin.
Switched to a new branch 'diffname'
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git commit -a
[diffname c5bbec1] ..
1 files changed, 1 insertions(+), 0 deletions(-)
szbwood-mbp15:proj4_local bwood$ git push
Everything up-to-date
La cosa strana è, il file di configurazione guarda bene ..
[branch "samename"]
remote = origin
merge = refs/heads/samename
[branch "diffname"]
remote = origin
merge = refs/heads/samename
La cosa strana è che il file di configurazione in .git sembra buono: – bruce
In realtà penso che il libro sia sbagliato, e leggendo la pagina man per push e questo SO post http://stackoverflow.com/questions/948354/git -push-current-branch aggiunge peso a questo.Sembra che se non si specifica esplicitamente il ramo da premere, git spinge TUTTI i rami locali che corrispondono ai nomi remoti. E se non si specifica il telecomando, si assume il telecomando del ramo corrente. Pertanto, molto spesso alle persone sembra che tracciare un ramo significhi che puoi spingere le tue modifiche con 'git push', ma penso che questo sia sbagliato. Git push sta spingendo tutte le filiali locali che corrispondono ai nomi remoti .. – bruce