Bir şubeye ödeme yaparsanız:
git checkout 760ac7e
örneğin b9ac70b, b9ac70bSHA1'i bilmeden bilinen son kafaya nasıl geri dönülebilir?
Bir şubeye ödeme yaparsanız:
git checkout 760ac7e
örneğin b9ac70b, b9ac70bSHA1'i bilmeden bilinen son kafaya nasıl geri dönülebilir?
Yanıtlar:
Hangi şubenin daha önce kontrol edildiğini hatırlarsanız (ör. master)
git checkout master
bağımsız HEAD durumundan çıkmak için .
Genel olarak konuşursak: git checkout <branchname>sizi bundan çıkarır.
Son şube adını hatırlamıyorsanız, deneyin
git checkout -
Bu aynı zamanda son teslim alınan şubenizi kontrol etmeye çalışır.
git checkout -b new_branch_nametakdirde, HEAD durumundayken yaptığınız taahhütleri kaybediyor musunuz?
git gcmevcutlar, ancak çalıştırıldığında sonsuza dek kaldırılıyorlar. git reflogHala orada oldukları sürece onları izleyebilirsiniz .
Ben dosya dizin yapısı farklı olduğu kodun önceki bir sürümünü teslim bu kenar durumu vardı:
git checkout 1.87.1
warning: unable to unlink web/sites/default/default.settings.php: Permission denied
... other warnings ...
Note: checking out '1.87.1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again.
Example:
git checkout -b <new-branch-name>
HEAD is now at 50a7153d7... Merge branch 'hotfix/1.87.1'
Böyle bir durumda --force kullanmanız gerekebilir (orijinal şubeye dönüp değişiklikleri atmanın güvenli bir şey olduğunu bildiğinizde).
git checkout master işe yaramadı:
$ git checkout master
error: The following untracked working tree files would be overwritten by checkout:
web/sites/default/default.settings.php
... other files ...
git checkout master --force(veya git checkout master -f) çalıştı:
git checkout master -f
Previous HEAD position was 50a7153d7... Merge branch 'hotfix/1.87.1'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
detached HEADEyalette bazı yeni taahhütler vermiş olabilirsiniz . Diğer cevapların önerdiği gibi yaparsanız inanıyorum:
git checkout master
# or
git checkout -
o zaman taahhütlerini kaybedebilir !! Bunun yerine, bunu yapmak isteyebilirsiniz:
# you are currently in detached HEAD state
git checkout -b commits-from-detached-head
ve sonra commits-from-detached-headistediğiniz dalı birleştirin , böylece taahhütleri kaybetmezsiniz.
git checkout -- katil özelliği!