Skip to content

Instantly share code, notes, and snippets.

@kmwarter
Last active October 23, 2024 03:29
Show Gist options
  • Select an option

  • Save kmwarter/cdb2b5ced478b817c712026f1247183d to your computer and use it in GitHub Desktop.

Select an option

Save kmwarter/cdb2b5ced478b817c712026f1247183d to your computer and use it in GitHub Desktop.

Most Used Git Commands

  1. git clone: Clone a repository into a new directory.
  2. git pull: Fetch and integrate changes from a remote repository.
  3. git push: Update the remote repository with local changes.
  4. git commit: Record changes to the repository.
  5. git status: Show the working tree status.
  6. git add: Add file contents to the index (staging area).
  7. git branch: List, create, or delete branches.
  8. git merge: Join two or more development histories together.
  9. git fetch: Download objects and refs from another repository.
  10. git log: Show the commit logs.
  11. git diff: Show changes between commits, commit and working tree, etc.
  12. git rebase: Reapply commits on top of another base tip.
  13. git tag: Create, list, or delete tags.
  14. git reset: Reset current HEAD to the specified state.
  15. git remote: Manage set of remotes.
  16. git checkout: Switch branches or restore working tree files.
  17. git init: Create an empty Git repository or reinitialize an existing one.
  18. git rm: Remove files from the working tree and index.
  19. git stash: Stash the changes in a dirty working directory.
  20. git config: Get and set repository or global options.
  21. git blame: Show what revision and author last modified each line of a file.
  22. git cherry-pick: Apply the changes introduced by some existing commits.
  23. git revert: Revert some existing commits.
  24. git bisect: Use binary search to find the commit that introduced a bug.
  25. git submodule: Initialize, update, or inspect submodules.
  26. git describe: Describe a commit using the most recent tag.
  27. git tag -d: Delete a tag.
  28. git shortlog: Summarize git log output.
  29. git archive: Create an archive of files from a named tree.
  30. git gc: Cleanup unnecessary files and optimize the local repository.
  31. git fetch --all: Fetch all branches from all remotes.
  32. git clean: Remove untracked files from the working directory.
  33. git ls-tree: List the contents of a tree object.
  34. git show: Show various types of objects.
  35. git reflog: Show reference logs.
  36. git grep: Print lines matching a pattern.
  37. git config --global: Set global configuration options.
  38. git merge --no-ff: Merge commits with a merge commit.
  39. git merge --squash: Combine changes from multiple commits into one.
  40. git format-patch: Prepare patches for e-mail submission.
  41. git difftool: Show changes using a diff tool.
  42. git log --oneline: Show commit logs in a concise format.
  43. git log --graph: Show commit logs with a graphical representation.
  44. git commit --amend: Modify the last commit.
  45. git checkout -b: Create and switch to a new branch.
  46. git ls-files: Show information about files in the index.
  47. git remote -v: Show remote repository URLs.
  48. git stash pop: Apply the top stash and remove it from the stash list.
  49. git stash apply: Apply a stash without removing it from the stash list.
  50. git diff --staged: Show changes between the index and the last commit.
  51. git describe --tags: Describe a commit with the most recent tag.
  52. git remote add: Add a new remote repository.
  53. git rebase -i: Interactively rebase commits.
  54. git tag -a: Create an annotated tag.
  55. git pull --rebase: Rebase instead of merging when pulling.
  56. git show-branch: Show branches and their commits.
  57. git reflog expire: Expire old reflog entries.
  58. git archive --format=zip: Create an archive of the repository in a zip format.
  59. git rm --cached: Remove files from the index without deleting them from the working directory.
  60. git fetch --prune: Remove remote-tracking branches that no longer exist on the remote.
  61. git push --force: Force push changes to the remote repository.
  62. git push --tags: Push all tags to the remote repository.
  63. git push --set-upstream: Set the upstream branch for the current branch.
  64. git pull --no-commit: Perform a pull without committing.
  65. git remote rm: Remove a remote repository.
  66. git branch -d: Delete a local branch.
  67. git branch -m: Rename a local branch.
  68. git commit -m: Commit changes with a message.
  69. git commit --no-edit: Commit with the existing commit message.
  70. git tag -l: List all tags.
  71. git log --stat: Show the commit logs with statistics.
  72. git log --patch: Show the commit logs with diffs.
  73. git stash list: List all stashes.
  74. git stash drop: Remove a stash.
  75. git stash clear: Clear all stashes.
  76. git rebase --onto: Rebase commits onto a different base.
  77. git reflog show: Show reflog entries for a specific reference.
  78. git filter-branch: Rewrite branches.
  79. git notes: Manage object notes.
  80. git show-ref: Show references.
  81. git difftool --dir-diff: Compare directories using a diff tool.
  82. git update-index: Modify the index entries.
  83. git svn: Interface with Subversion repositories.
  84. git cherry: Find commits that are in one branch but not in another.
  85. git worktree: Manage multiple working trees.
  86. git notes add: Add a note to an object.
  87. git filter-repo: Filter repository history (alternative to filter-branch).
  88. git bundle: Create and apply Git bundles.
  89. git reflog expire --expire: Expire reflog entries based on age.
  90. git daemon: A simple server for Git repositories.
  91. git instaweb: Launch a web server to view a repository.
  92. git mergetool: Run a merge conflict resolution tool.
  93. git blame --line-porcelain: Output blame information in a parseable format.
  94. git diff --word-diff: Show word diff in changes.
  95. git prune: Remove objects that are no longer reachable.
  96. git gc --aggressive: Perform an aggressive garbage collection.
  97. git gc --prune: Prune objects older than a specified date.
  98. git bisect start: Start a bisect session.
  99. git rerere: Reuse recorded resolutions of conflicted merges.
  100. git svn rebase: Rebase Subversion branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment