İçeriğe geç
uxTools
Geliştirici

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

Komut ara

Kurulum ve yapılandırma

7
  • git init

    Create an empty Git repository in the current directory.

    Örnekgit init my-project
  • git clone <url>

    Copy a remote repository, including its full history, locally.

    Örnekgit clone [email protected]:user/repo.git
  • git 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 main
  • git config --list

    Print every effective configuration value and where it came from.

    Örnekgit config --list --show-origin
  • git config --global alias.<short> <command>

    Define a shorthand for a longer command you type often.

    Örnekgit config --global alias.co "checkout"

Hazırlama

7
  • git add <path>

    Stage changes from a file or directory for the next commit.

    Örnekgit add src/index.ts
  • git add .

    Stage every change in the current directory and below.

  • git add -p

    Interactively 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.txt
  • git rm --cached <path>

    Stop tracking a file but keep it on disk (e.g. once gitignored).

    Örnekgit rm --cached .env
  • git mv <src> <dest>

    Rename or move a tracked file and stage the change in one step.

    Örnekgit mv util.ts helpers.ts
  • git restore --staged <path>

    Unstage a file, leaving its working-tree changes untouched.

    Örnekgit restore --staged src/index.ts

Commit

5
  • git 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 --amend

    Rewrite the most recent commit (its message or contents).

    Örnekgit commit --amend -m "Better message"
  • git commit --amend --no-edit

    Fold 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

8
  • git branch

    List the local branches; the current one is marked with `*`.

    Örnekgit branch -a
  • git branch <name>

    Create a new branch at the current commit without switching to it.

    Örnekgit branch feature/login
  • git switch <name>

    Move to an existing branch, updating the working tree.

    Örnekgit switch main
  • git switch -c <name>

    Create a new branch and switch to it in one step.

    Örnekgit switch -c feature/login
  • git checkout <name>

    Switch branches (the classic command; `switch` is the modern split).

    Örnekgit checkout develop
  • git branch -d <name>

    Delete a branch that has already been merged.

    Örnekgit branch -d feature/login
  • git branch -D <name>

    Force-delete a branch even if it has unmerged commits.

    Örnekgit branch -D experiment
  • git branch -m <old> <new>

    Rename a branch (omit `<old>` to rename the current branch).

    Örnekgit branch -m master main

Birleştirme ve rebase

8
  • git merge <branch>

    Join another branch's history into the current branch.

    Örnekgit merge feature/login
  • git merge --no-ff <branch>

    Always create a merge commit, even for a fast-forwardable merge.

    Örnekgit merge --no-ff release/1.2
  • git merge --abort

    Bail 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 main
  • git rebase -i <ref>

    Interactively reorder, squash, edit, or drop a range of commits.

    Örnekgit rebase -i HEAD~3
  • git rebase --continue

    Resume a rebase after resolving the current conflict.

  • git rebase --abort

    Cancel 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

8
  • git remote -v

    List 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.git
  • git fetch <remote>

    Download new objects and refs from a remote without merging.

    Örnekgit fetch origin
  • git pull

    Fetch from the tracked remote branch and integrate it into yours.

    Örnekgit pull --rebase
  • git push

    Upload local commits on the current branch to its remote.

    Örnekgit push origin main
  • git push -u <remote> <branch>

    Push a branch and set it to track the remote for future pulls.

    Örnekgit push -u origin feature/login
  • git push --force-with-lease

    Force-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

7
  • git restore <path>

    Discard working-tree changes in a file, reverting to HEAD.

    Örnekgit restore src/index.ts
  • git restore --source <ref> <path>

    Restore a file's contents from a specific commit.

    Örnekgit restore --source HEAD~2 README.md
  • git reset <path>

    Unstage a file while keeping the working-tree changes.

    Örnekgit reset src/index.ts
  • git reset --soft <ref>

    Move HEAD to a commit but keep changes staged.

    Örnekgit reset --soft HEAD~1
  • git reset --hard <ref>

    Move HEAD and discard all staged and working-tree changes.

    Örnekgit reset --hard origin/main
  • git revert <commit>

    Create a new commit that undoes a previous one, keeping history.

    Örnekgit revert a1b2c3d
  • git clean -fd

    Delete untracked files and directories from the working tree.

    Örnekgit clean -fdn

Stash

6
  • git stash

    Shelve uncommitted changes and revert to a clean working tree.

    Örnekgit stash push -m "WIP login form"
  • git stash -u

    Stash changes including untracked files.

  • git stash list

    Show all stashed change sets you have saved.

  • git stash pop

    Reapply 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

7
  • git status

    Show staged, unstaged, and untracked changes in the working tree.

    Örnekgit status -s
  • git log

    Show the commit history of the current branch.

    Örnekgit log --oneline --graph --all
  • git diff

    Show unstaged changes between the working tree and the index.

    Örnekgit diff --staged
  • git show <ref>

    Show the metadata and diff introduced by one commit.

    Örnekgit show HEAD
  • git blame <path>

    Annotate each line of a file with the commit that last changed it.

    Örnekgit blame src/index.ts
  • git reflog

    List every position HEAD has pointed to — a safety net for recovery.

  • git bisect start

    Begin a binary search through history to find a regression.

    Örnekgit bisect bad && git bisect good v1.0

Etiketler ve sürümler

6
  • git tag

    List 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.0
  • git 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.0
  • git push <remote> --tags

    Publish every local tag to a remote at once.

    Örnekgit push origin --tags
  • git 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.