Git komutları hızlı referans

Git, dosya değişikliklerinizi bir depodaki bir dizi commit olarak izler. Bu komutlar günlük akışı kapsar: depo başlatma, çalışmayı kaydetme, dallanma, birleştirme ve uzakla paylaşma. Öğrenirken bu sayfayı açık tutun.

Güncellendi:

KomutNe yapar
git initCreate a new, empty Git repository in the current directory.
git cloneDownload a remote repository and its full history to your machine.
git statusShow changed, staged and untracked files in the working tree.
git addStage changes (files) to be included in the next commit.
git commitRecord staged changes as a new commit with a message.
git logDisplay the commit history of the repository.
git diffShow unstaged or staged differences between states.
git branchList, create or delete branches in the repository.
git checkout / switchSwitch branches or restore files (switch is the modern command).
git mergeJoin another branch's history into the current branch.
git rebaseReapply commits on top of another base commit, rewriting history.
git pullFetch from a remote and merge the changes into the current branch.
git pushUpload local commits to a remote repository.
git stashTemporarily shelve uncommitted changes to reapply later.
git remoteManage the set of remote repositories you track.

Notlar

Sık sorulan sorular

merge ve rebase arasındaki fark nedir?
Merge, iki ebeveyni olan yeni bir commit ile geçmişleri birleştirir. Rebase ise commit'lerinizi başka bir dalın üzerine yeniden oynatır; doğrusal bir geçmiş oluşturur ama commit ID'lerini yeniden yazar.
Bir commit'i nasıl geri alırım?
Değişikliği geri alan yeni bir commit eklemek için 'git revert <commit>' kullanın (güvenli, paylaşılan geçmiş korunur). 'git reset' geçmişi yeniden yazar ve paylaşılan dallarda kullanılmamalıdır.
git pull ve git fetch arasındaki fark nedir?
Fetch, çalışma ağacınıza dokunmadan uzaktan commit ve referansları indirir. Pull, fetch yapar ve ardından bu değişiklikleri geçerli dalınıza merge veya rebase eder.
git stash ne zaman kullanılır?
Stash, commit edilmemiş değişiklikleri geçici olarak rafa kaldırır; böylece dal değiştirebilir veya temiz bir pull yapabilir, sonra 'git stash pop' ile geri getirebilirsiniz.