Git Komut Rehberi
Her gün ulaştığın Git komutlarının kategorilere göre gruplanmış, aranabilir bir referansı. Bir komutu bul, açıklamasını oku ve tek tıkla kopyala.
69
Komut
10
Kategori
69
Gösterilen
Kurulum ve yapılandırma
7git initCreate an empty Git repository in the current directory.
Örnekgit init my-projectgit clone <url>Copy a remote repository, including its full history, locally.
Örnekgit clone [email protected]:user/repo.gitgit config --global user.name <name>Set the author name attached to every commit you make.
Örnekgit config --global user.name "Ada Lovelace"git config --global user.email <email>Set the author email attached to every commit you make.
Örnekgit config --global user.email "[email protected]"git config --global init.defaultBranch <name>Choose the default branch name used by future `git init` calls.
Örnekgit config --global init.defaultBranch maingit config --listPrint every effective configuration value and where it came from.
Örnekgit config --list --show-origingit config --global alias.<short> <command>Define a shorthand for a longer command you type often.
Örnekgit config --global alias.co "checkout"
Hazırlama
7git add <path>Stage changes from a file or directory for the next commit.
Örnekgit add src/index.tsgit add .Stage every change in the current directory and below.
git add -pInteractively choose which hunks of each change to stage.
git rm <path>Remove a tracked file from the tree and stage the deletion.
Örnekgit rm old-file.txtgit rm --cached <path>Stop tracking a file but keep it on disk (e.g. once gitignored).
Örnekgit rm --cached .envgit mv <src> <dest>Rename or move a tracked file and stage the change in one step.
Örnekgit mv util.ts helpers.tsgit restore --staged <path>Unstage a file, leaving its working-tree changes untouched.
Örnekgit restore --staged src/index.ts
Commit
5git commit -m <message>Record the staged snapshot with a one-line commit message.
Örnekgit commit -m "Fix off-by-one in pager"git commit -am <message>Stage every tracked modification and commit it in one step.
Örnekgit commit -am "Tidy up imports"git commit --amendRewrite the most recent commit (its message or contents).
Örnekgit commit --amend -m "Better message"git commit --amend --no-editFold newly staged changes into the last commit, keeping its message.
git commit --allow-empty -m <message>Record a commit with no changes, e.g. to trigger CI.
Örnekgit commit --allow-empty -m "Trigger deploy"
Dallar
8git branchList the local branches; the current one is marked with `*`.
Örnekgit branch -agit branch <name>Create a new branch at the current commit without switching to it.
Örnekgit branch feature/logingit switch <name>Move to an existing branch, updating the working tree.
Örnekgit switch maingit switch -c <name>Create a new branch and switch to it in one step.
Örnekgit switch -c feature/logingit checkout <name>Switch branches (the classic command; `switch` is the modern split).
Örnekgit checkout developgit branch -d <name>Delete a branch that has already been merged.
Örnekgit branch -d feature/logingit branch -D <name>Force-delete a branch even if it has unmerged commits.
Örnekgit branch -D experimentgit branch -m <old> <new>Rename a branch (omit `<old>` to rename the current branch).
Örnekgit branch -m master main
Birleştirme ve rebase
8git merge <branch>Join another branch's history into the current branch.
Örnekgit merge feature/logingit merge --no-ff <branch>Always create a merge commit, even for a fast-forwardable merge.
Örnekgit merge --no-ff release/1.2git merge --abortBail out of an in-progress merge and restore the pre-merge state.
git rebase <branch>Replay the current branch's commits on top of another branch.
Örnekgit rebase maingit rebase -i <ref>Interactively reorder, squash, edit, or drop a range of commits.
Örnekgit rebase -i HEAD~3git rebase --continueResume a rebase after resolving the current conflict.
git rebase --abortCancel an in-progress rebase and return to the original state.
git cherry-pick <commit>Apply the change introduced by one commit onto the current branch.
Örnekgit cherry-pick a1b2c3d
Uzak depolar
8git remote -vList the configured remotes and their fetch/push URLs.
git remote add <name> <url>Register a new remote repository under a short name.
Örnekgit remote add origin [email protected]:user/repo.gitgit fetch <remote>Download new objects and refs from a remote without merging.
Örnekgit fetch origingit pullFetch from the tracked remote branch and integrate it into yours.
Örnekgit pull --rebasegit pushUpload local commits on the current branch to its remote.
Örnekgit push origin maingit push -u <remote> <branch>Push a branch and set it to track the remote for future pulls.
Örnekgit push -u origin feature/logingit push --force-with-leaseForce-push safely, refusing to clobber remote work you have not seen.
git push <remote> --delete <branch>Delete a branch on the remote.
Örnekgit push origin --delete feature/login
Geri alma
7git restore <path>Discard working-tree changes in a file, reverting to HEAD.
Örnekgit restore src/index.tsgit restore --source <ref> <path>Restore a file's contents from a specific commit.
Örnekgit restore --source HEAD~2 README.mdgit reset <path>Unstage a file while keeping the working-tree changes.
Örnekgit reset src/index.tsgit reset --soft <ref>Move HEAD to a commit but keep changes staged.
Örnekgit reset --soft HEAD~1git reset --hard <ref>Move HEAD and discard all staged and working-tree changes.
Örnekgit reset --hard origin/maingit revert <commit>Create a new commit that undoes a previous one, keeping history.
Örnekgit revert a1b2c3dgit clean -fdDelete untracked files and directories from the working tree.
Örnekgit clean -fdn
Stash
6git stashShelve uncommitted changes and revert to a clean working tree.
Örnekgit stash push -m "WIP login form"git stash -uStash changes including untracked files.
git stash listShow all stashed change sets you have saved.
git stash popReapply the most recent stash and remove it from the list.
git stash apply <stash>Reapply a stash but keep it in the list for reuse.
Örnekgit stash apply stash@{1}git stash drop <stash>Delete a single stash from the list.
Örnekgit stash drop stash@{0}
Geçmişi inceleme
7git statusShow staged, unstaged, and untracked changes in the working tree.
Örnekgit status -sgit logShow the commit history of the current branch.
Örnekgit log --oneline --graph --allgit diffShow unstaged changes between the working tree and the index.
Örnekgit diff --stagedgit show <ref>Show the metadata and diff introduced by one commit.
Örnekgit show HEADgit blame <path>Annotate each line of a file with the commit that last changed it.
Örnekgit blame src/index.tsgit reflogList every position HEAD has pointed to — a safety net for recovery.
git bisect startBegin a binary search through history to find a regression.
Örnekgit bisect bad && git bisect good v1.0
Etiketler ve sürümler
6git tagList the existing tags in the repository.
Örnekgit tag -l "v1.*"git tag <name>Create a lightweight tag pointing at the current commit.
Örnekgit tag v1.2.0git tag -a <name> -m <message>Create an annotated tag with its own message and metadata.
Örnekgit tag -a v1.2.0 -m "Release 1.2.0"git push <remote> <tag>Publish a single tag to a remote.
Örnekgit push origin v1.2.0git push <remote> --tagsPublish every local tag to a remote at once.
Örnekgit push origin --tagsgit tag -d <name>Delete a local tag.
Örnekgit tag -d v1.2.0
Bu rehber hakkında
Komutlar resmi Git başvuru kılavuzundan ve Pro Git kitabından derlendi. Açısal parantezler (<dal> gibi) kendi değerinle değiştireceğin yer tutuculardır. Hiçbir şey tarayıcından ayrılmaz; bu sayfa tamamen istemci tarafında çalışır.