0% found this document useful (0 votes)
5 views

Git Commands Table

This document provides a comprehensive list of Git commands along with their syntax and purposes. It covers essential commands for repository management, including initialization, cloning, staging, committing, and pushing changes, as well as branch management and history viewing. Additionally, it includes commands for configuration, cleanup, and managing remote repositories and submodules.

Uploaded by

basserosa0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Git Commands Table

This document provides a comprehensive list of Git commands along with their syntax and purposes. It covers essential commands for repository management, including initialization, cloning, staging, committing, and pushing changes, as well as branch management and history viewing. Additionally, it includes commands for configuration, cleanup, and managing remote repositories and submodules.

Uploaded by

basserosa0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Git Commands, Syntax, and Usage

Command Syntax Purpose

git init git init Initializes a new Git repository in the current

git clone git clone <repository_url> Clones an existing repository from a remote

git status git status Shows the status of changes in the working d

git add git add <file> Stages changes to be committed. Use '.' to s

git commit git commit -m "<message>" Records staged changes in the repository wi

git push git push <remote> <branch> Pushes local commits to the remote reposito

git pull git pull <remote> <branch> Fetches and integrates changes from a remo

git fetch git fetch <remote> Fetches changes from a remote repository w

git merge git merge <branch> Merges changes from the specified branch in

git branch git branch Lists, creates, or deletes branches....

git checkout git checkout <branch> Switches to the specified branch or commit..

git switch git switch <branch> Switches branches (an alternative to git chec

git log git log Displays the commit history for the repository

git diff git diff Shows changes between the working directo

git stash git stash Temporarily saves changes in the working di

git rebase git rebase <branch> Reapplies commits from the current branch o

git reset git reset <file> Unstages changes from the staging area or m

git rm git rm <file> Removes a file from the repository and work

git mv git mv <old_name> <new_name> Renames or moves a file....

git tag git tag <tag_name> Creates a tag for marking a specific commit (

git remote git remote <action> Manages remote repository connections (e.g

git show git show <commit> Displays detailed information about a specific

git config git config <option> <value> Configures Git settings (e.g., username, ema

git archive git archive <branch> --output=<file> Creates a tar or zip archive of the repository
git cherry-pick git cherry-pick <commit> Applies changes from a specific commit onto

git blame git blame <file> Shows which commit and author modified ea

git bisect git bisect start Uses binary search to find the commit that in

git log git log --oneline --graph Displays commit history in a compact graphic

git ls-files git ls-files Lists tracked files in the repository....

git gc git gc Cleans up unnecessary files and optimizes th

git describe git describe Shows the most recent tag reachable from th

git revert git revert <commit> Creates a new commit that undoes changes

git submodule git submodule <action> Manages submodules in a repository (e.g., a

git worktree git worktree add <path> <branch> Creates additional working trees linked to the

git clean git clean -f Removes untracked files from the working di

git tag -d git tag -d <tag> Deletes a tag from the local repository....

git reflog git reflog Shows a log of all references (HEAD change

You might also like