SORU
29 NİSAN 2011, Cuma


Son güncelleme Gıt kökeni üzerine işlemek için submodule

Git submodule ile bir projem var. Taahhüt A. B bu URL bir köşeye itildi bir ssh://... URL, taahhüt ve submodule tamamlama almasını ve bunu değiştirmek istiyorum.

Şimdi, benim anladığım git submodule update bunu yapmak gerekir, ama değil. Hiçbir şey (hiçbir çıkış, başarı, çıkış kodu) yapmaz. İşte size bir örnek:

$ mkdir foo
$ cd foo
$ git init .
Initialized empty Git repository in /.../foo/.git/
$ git submodule add ssh://user@host/git/mod mod
Cloning into mod...
user@host's password: hunter2
remote: Counting objects: 131, done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 131 (delta 54), reused 0 (delta 0)
Receiving objects: 100% (131/131), 16.16 KiB, done.
Resolving deltas: 100% (54/54), done.
$ git commit -m "Hello world."
[master (root-commit) 565b235] Hello world.
 2 files changed, 4 insertions( ), 0 deletions(-)
 create mode 100644 .gitmodules
 create mode 160000 mod
# At this point, ssh://user@host/git/mod changes; submodule needs to change too.
$ git submodule init
Submodule 'mod' (ssh://user@host/git/mod) registered for path 'mod'
$ git submodule update
$ git submodule sync
Synchronizing submodule url for 'mod'
$ git submodule update
$ man git-submodule 
$ git submodule update --rebase
$ git submodule update
$ echo $?
0
$ git status
# On branch master
nothing to commit (working directory clean)
$ git submodule update mod
$ ...

Ayrıca bir fetch yapmak için görünür git fetch mod, (ama bir şifre sorulması değil, çünkü muhtemelen, olamaz!), denedim ama git log git show yeni varlığını inkar tamamlar. Şimdiye kadar sadece rm-ıng modüle edilmiş ve yeniden ekleme yaptım ama bu iki prensip olarak yanlış ve pratikte sıkıcı bir iştir.

CEVAP
29 NİSAN 2011, Cuma


git submodule update komut alt modüller, zaten superproject dizini belirtilen taahhüt kontrol etmek için her istediğiniz aslında Gıt söyler. İstersenizgüncellemeen son senin alt modüller kendi uzaktan kullanılabilir işlemek, bu doğrudan alt modüller yapmak gerekir.

Yani Özet:

# get the submodule initially
git submodule add ssh://bla submodule_dir
git submodule init

# time passes, submodule upstream is updated
# and you now want to update

# change to the submodule directory
cd submodule_dir

# checkout desired branch
git checkout master

# update
git pull

# get back to your project root
cd ..

# now the submodules are in the state you want, so
git commit -am "Pulled down update to submodule_dir"

Ya da, eğer yoğun bir kişi iseniz:

git submodule foreach git pull origin master

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Jonathan Leack

    Jonathan Lea

    26 ŞUBAT 2007
  • joshsnice

    joshsnice

    28 Kasım 2006
  • Need for Speed

    Need for Spe

    8 ŞUBAT 2006