SORU
14 NİSAN 2010, ÇARŞAMBA


İşleme git içinde yeniden adlandırır dosya

renaming files in git değişiklikleri kaydetme, yeniden adlandırma yapmak ve sonra yeniden adlandırılan dosya evre gerektiğini okumuştum. Git yeni izlenmeyen bir dosya olarak görmekten ziyade içeriğinden dosyasını tanımak, ve değişiklik geçmişini tutar.

Ancak, bu gece bunu yapıyorum git mv dönüştürme sona erdi.

> $ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   index.html
#

mobile.css iphone.css Bulucu benim stil yeniden adlandırın

> $ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   index.html
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    css/iphone.css
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   css/mobile.css

O yüzden git şimdi bir CSS dosyası silinmiş olduğumu düşünüyor, ve bir yenisini daha ekledi. Ne istiyorum, yeniden adlandırma Geri Al ve git hadi iş yapalım.

> $ git reset HEAD .
Unstaged changes after reset:
M   css/iphone.css
M   index.html

Başladığım yere geri.

> $ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   index.html
#

Kullanım sağlar git mv yerine.

> $ git mv css/iphone.css css/mobile.css
> $ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   renamed:    css/iphone.css -> css/mobile.css
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   index.html
#

Görünüşe göre iyi. Neden git Bulucu kullandım ilk kez etrafında yeniden tanımadı?

CEVAP
14 NİSAN 2010, ÇARŞAMBA


git mv için manual page diyor

Dizin başarıyla tamamlanmasından sonra,güncellenir [....]

Bu yüzden, ilk önce kendi dizini güncelleştirmek için (git add mobile.css kullanarak). Ancak
git status yine de iki farklı dosyaları göster

$ git status
# On branch master
warning: LF will be replaced by CRLF in index.html
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   index.html
#       new file:   mobile.css
#
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    iphone.css
#

Çalıştırarak farklı bir çıkış alabilirsiniz Sen ne sonuçlar git commit --dry-run -a bekliyoruz

Tanascius@H181 /d/temp/blo (master)
$ git commit --dry-run -a
# On branch master
warning: LF will be replaced by CRLF in index.html
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   index.html
#       renamed:    iphone.css -> mobile.css
#

Bu farklılıklar görüyoruz tam olarak anlatamam git status arasında
* *23, ama buradan bir ipucu. Linus

git gerçekten bile yokbakımbütün hakkında "yeniden algılama" içten ve birini yapması bitti adlandırır tamamen bağımsız olan, biz daha sonra kullanmak sezgiselgösteryeniden adlandırır.

dry-run bir süre gerçek yeniden adlandırma mekanizmaları kullanır git status muhtemelen gelmez.

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Glove and Boots

    Glove and Bo

    1 ŞUBAT 2007
  • KSI

    KSI

    25 Temmuz 2009
  • trickycharms

    trickycharms

    6 Aralık 2013