Git all Commands

Posted by

Git commands and a synopsis of their functions are as follows:

Install Git standalone on Windows: The official Git website offers the Git for Windows software for download. You will be guided through the installation procedure by this installer.
Using Chocolatey: Making Use of Chocolatey You can install Git by typing the following command in PowerShell or the command prompt if you have installed Chocolatey:

  1. git config: Configure user information for all local repositories.
git config --global "Your Name"
git config --global ""

2. git init: Initialize a new Git repository.

git init

3. git clone: Clone a repository into a newly created directory.

git clone <repository-url>

4. git add: Add file contents to the staging area.

git add <file-name>
git add -A

5. git commit: Record changes to the repository.

git commit -m "Commit message"

6. git status: Show the working tree status.

git status

7. git diff: Show changes between commits, commit and working tree, etc.

git diff

8. git reset: Reset current HEAD to the specified state.

git reset --hard

9. git rm: Remove files from the working tree and from the index.

git rm <file-name>

10. git log: Show commit logs.

git log
git log --oneline

11. git show: Show various types of objects.

git show <commit-hash>

12. git tag: Create, list, delete or verify a tag object signed with GPG.

git tag -a <tag-name> -m "Tag message"

13. git branch: List, create, or delete branches.

git branch
git branch <branch-name>
git branch -d <branch-name>

14. git checkout: Switch branches or restore working tree files.

git checkout <branch-name>
git checkout -b <new-branch-name>

15. git merge: Join two or more development histories together.

git merge <branch-name>

16. git remote: Manage set of tracked repositories.

git remote add origin <repository-url>

17. git push: Update remote refs along with associated objects.

git push origin <branch-name>

18. git pull: Fetch from and integrate with another repository or a local branch.

git pull origin <branch-name>

19. git stash: Stash the changes in a dirty working directory away.

git stash
git stash clear

20. git revert: Revert some existing commits.

git revert <commit-hash>

Git features ranging from simple repository management to more intricate processes like merging and rebasing are covered by these commands. Keep in mind that Git has a large number of commands and parameters, so it’s helpful to consult the official Git manual or use git help to get additional information about particular commands in detail.

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x