You are on page 1of 3

Full list of Git commands

1. git init: Initializes a new Git repository.


2. git clone <repository-url>: Creates a local copy of a remote Git repository.
3. git add <file>: Adds a file or changes to the staging area.
4. git commit -m <message>: Commits the changes in the staging area to the
local repository.
5. git push: Uploads local commits to a remote repository.
6. git pull: Retrieves and merges the latest changes from a remote repository.
7. git branch: Lists all branches in the repository.
8. git checkout <branch>: Switches to a different branch.
9. git merge <branch>: Incorporates changes from a specified branch into the
current branch.
10. git status: Displays the current state of the repository.
11. git log: Shows a chronological list of commits.
12. git remote add <name> <repository-url>: Adds a remote repository to your
local Git configuration.
13. git remote -v: Lists all remote repositories configured in your local Git
repository.
14. git stash: Temporarily saves changes that are not ready to be committed.
15. git fetch: Retrieves the latest changes from a remote repository.
16. git rebase: Moves or combines commits to a new base commit.
17. git reset: Undoes or removes commits from the current branch.
18. git cherry-pick: Selectively applies a single commit from one branch to
another.
19. git tag: Creates a named pointer to a specific commit.
20. git remote update: Updates all remote-tracking branches in your local
repository.
21. git submodule: Manages Git submodules within a repository.
22. git blame: Shows commit and author information for each line in a file.
23. git cherry: Lists commits that exist in one branch but not in another.
24. git reflog: Displays a log of all reference changes in the repository.
25. git grep: Searches for a specified pattern in the contents of files within
the repository.
26. git branch -d <branch>: Deletes a specified branch from the local
repository.
27. git clean: Removes untracked files from the working directory.
28. git bisect: Helps find the specific commit that introduced a bug.
29. git diff: Shows differences between different versions of files in the
repository.
30. git mv <old-path> <new-path>: Renames or moves a file or directory.
31. git log --graph: Displays a graphical representation of the commit history.
32. git remote remove <name>: Removes a remote repository from your local Git
configuration.
33. git submodule init: Initializes Git submodules within a repository.
34. git submodule update: Updates Git submodules within a repository.
35. git revert: Creates a new commit that undoes changes made in a previous
commit.
36. git show: Displays detailed information about a specific commit.
37. git tag -a <tag-name> -m <message>: Creates an annotated tag with a name
and message.
38. git remote rename <old-name> <new-name>: Renames a remote repository's
short name in your local Git configuration.
39. git stash apply: Restores the most recent stash and applies the changes to
your working directory.
40. git bisect start: Initiates the binary search process to find a specific
commit.
41. git show-branch: Displays the branches and their commits in a compact
format.
42. git tag -d <tag-name>: Deletes a specific tag from the repository.
43. git blame -L <start>,<end> <file>: Shows the commit and author information
for a specific range of lines within a file.
44. git cherry-pick --abort: Cancels the cherry-pick operation and restores the
repository to its state before the cherry-pick attempt.
45. git show-refs: Displays detailed information about references in the
repository.
46. git rebase -i: Initiates an interactive rebase.
47. git push --tags: Uploads all tags to a remote repository.
48. git remote prune <name>: Removes remote branches that no longer exist on
the remote repository.
49. git stash list: Lists all stashed changes in the repository.
50. git stash drop: Deletes the most recent stash.
51. git branch -r: Lists remote branches in the repository.
52. git log --oneline: Displays a concise list of commits.
53. git reset --hard <commit>: Resets the working directory and staging area to
match the specified commit.
54. git remote show <name>: Displays detailed information about a specific
remote repository.
55. git rev-parse: Outputs the SHA-1 hash of a specific commit or reference.
56. git pull --rebase: Retrieves and rebases the latest changes from a remote
repository.
57. git fetch --prune: Retrieves the latest changes from a remote repository
and prunes deleted branches.
58. git branch -a: Lists all branches (local and remote) in the repository.
59. git log --author=<author>: Displays the commit history filtered by a
specific author.
60. git push --force: Forces the upload of local commits to a remote
repository, overwriting its history.
61. git diff --cached: Shows the differences in the staging area.
62. git stash pop: Restores the most recent stash and applies the changes, then
removes the stash.
63. git pull --rebase origin <branch>: Retrieves and rebases the latest changes
from a specific branch in a remote repository.
64. git revert --no-edit <commit>: Reverts the changes made in a specific
commit without opening an editor for a new commit message.
65. git rev-list --all: Lists all commits reachable from all branches in the
repository.
66. git cherry-pick -x <commit>: Selectively applies a single commit from one
branch to another, including the original commit message.
67. git log --since=<date>: Displays the commit history since a specific date.
68. git stash drop <stash>: Deletes a specific stash.
69. git reflog show <branch>: Displays the reference log for a specific branch.
70. git diff --name-only: Shows the names of files with differences between
different versions.
71. git stash branch <branch> <stash>: Creates a new branch and applies a
specific stash to it.
72. git clean -f: Removes untracked files from the working directory
forcefully.
73. git bisect bad: Marks the current commit as bad during the git
bisect operation.
74. git show HEAD: Displays detailed information about the latest commit.
75. git branch -vv: Lists all branches with additional information such as the
upstream branch and the last commit.
76. git log --grep=<pattern>: Displays the commit history that matches a
specific pattern.
77. git reflog expire --expire-unreachable=now --all: Cleans up expired reflog
entries.
78. git grep --cached <pattern>: Searches for a specific pattern in the
contents of files in the staging area.
79. git commit --amend: Modifies the most recent commit.
80. git log --abbrev-commit: Displays a list of commits with abbreviated commit
hashes.
81. git log --name-status: Shows the commit history with the added, modified,
or deleted status of files.
82. git stash save <message>: Stashes changes with a custom message.
83. git bisect good: Marks the current commit as good during the git
bisect operation.
84. git diff HEAD~3..HEAD~2: Shows the differences between two specific
commits.
85. git log --before=<date>: Displays the commit history before a specific
date.
86. git stash clear: Removes all stashed changes from the repository.
87. git reflog expire --expire=now --all: Expires all reflog entries.
88. git grep -i <pattern>: Performs a case-insensitive search for a specific
pattern in the contents of files within the repository.
89. git cherry-pick --no-commit <commit>: Selectively applies a single commit
from one branch to another without creating a new commit.
90. git log --after=<date>: Displays the commit history after a specific date.
91. git stash show: Shows the changes contained within the most recent stash.
92. git revert --continue: Continues the revert process after resolving
conflicts.
93. git ls-remote: Displays references in a remote repository.
94. git reflog delete <ref>: Deletes a specific reflog reference.
95. git diff <commit-A>..<commit-B>: Shows the differences between two specific
commits.
96. git stash drop <stash>: Deletes a specific stash.
97. git diff HEAD~3..HEAD~2: Shows the differences between two specific
commits.
98. git log --before=<date>: Displays the commit history before a specific
date.
99. git stash clear: Removes all stashed changes from the repository.
100. git reflog expire --expire=now --all: Expires all reflog entries.

You might also like