Sign in to enable bookmarking, reminders, progress-tracking and more...
git add -A
Add all new and changed files to the staging area
git add <pathname>
Stage changes for the next commit
git branch
List all branches
git branch -m <old_branchname> <new_branchname>
Rename a branch
git checkout -b <branchname>
Create a new branch and switch to it
git checkout <branchname>
Switch to a different branch
git commit -a
Commits any changes to tracked files in the current repository.
git commit -m <message>
Commit staged changes with a message
git diff HEAD
Show uncommitted changes
git fetch
Download remote changes
git init
Initialize a Git repository in the current directory
git log
Show the commit history
git merge <branchname>
Merge a branch into the current branch
git pull
Fetch and merge remote changes
git push
Uploads local repository content to a remote repository
git restore --staged <pathname>
Unstages the specified file/s
git rm -f <pathname>
Forcefully removes a file from the working directory and stages the deletion.
git status
Show the status of the current repository
git add -A
Add all new and changed files to the staging area
git add <pathname>
Stage changes for the next commit
git branch
List all branches
git branch -m <old_branchname> <new_branchname>
Rename a branch
git checkout -b <branchname>
Create a new branch and switch to it
git checkout <branchname>
Switch to a different branch
git commit -a
Commits any changes to tracked files in the current repository.
git commit -m <message>
Commit staged changes with a message
git diff HEAD
Show uncommitted changes
git fetch
Download remote changes
git init
Initialize a Git repository in the current directory
git log
Show the commit history
git merge <branchname>
Merge a branch into the current branch
git pull
Fetch and merge remote changes
git push
Uploads local repository content to a remote repository
git restore --staged <pathname>
Unstages the specified file/s
git rm -f <pathname>
Forcefully removes a file from the working directory and stages the deletion.
git status
Show the status of the current repository
git blame <pathname>
identify changes in a file by author and time.
git branch -D <branchname>
Delete a branch forcefully
git checkout -
Switch to the branch last checked out
git checkout --<pathname>
Discard changes in working directory.
git checkout HEAD <pathname>
Restore a file from the most recent commit
git cherry-pick <commitA>
Apply the changes introduced by <commitA> on top of the current branch.
git clone <repo_url> <local_repo_name>
Creates a copy of a remote repository with a different name on your local machine
git commit --amend -m <message>
Change the commit message in the last commit
git diff --stat
View a summary of changes between your working directory and the staging area
git diff HEAD --stat
View a summary of changes from the last commit
git log --oneline --graph
Displays condensed repository history in a graphical format.
git push origin -d <branchname>
Delete a remote branch
git rebase <branchname>
reapply commits from the current branch onto <branchname>
git show <commit>
Displays content changes of a specific commit
git stash
Temporarily saves changes that are not ready to be committed.
git stash save <message>
Stash changes with a custom message
git blame <pathname>
identify changes in a file by author and time.
git branch -D <branchname>
Delete a branch forcefully
git checkout -
Switch to the branch last checked out
git checkout --<pathname>
Discard changes in working directory.
git checkout HEAD <pathname>
Restore a file from the most recent commit
git cherry-pick <commitA>
Apply the changes introduced by <commitA> on top of the current branch.
git clone <repo_url> <local_repo_name>
Creates a copy of a remote repository with a different name on your local machine
git commit --amend -m <message>
Change the commit message in the last commit
git diff --stat
View a summary of changes between your working directory and the staging area
git diff HEAD --stat
View a summary of changes from the last commit
git log --oneline --graph
Displays condensed repository history in a graphical format.
git push origin -d <branchname>
Delete a remote branch
git rebase <branchname>
reapply commits from the current branch onto <branchname>
git show <commit>
Displays content changes of a specific commit
git stash
Temporarily saves changes that are not ready to be committed.
git stash save <message>
Stash changes with a custom message
git branch -a --contains <commit>
List all branches that contain commit <commit>, including remote branches.
git checkout --theirs <pathname>
Resolve a merge conflict by accepting the "incoming" branch changes
git config --global user.name <username>
Set the global username for git
git grep -i "search pattern"
Search for patterns in the repository, ignoring the case of the search pattern
git pull --rebase
Rebase the remote branch into the local one
git reset --hard
Discard all changes and revert to the commit specified
git reset --soft HEAD~1
Reset the current branch and move the HEAD pointer to the previous commit, keeping the changes staged.
git reset <commit> --merge
Undo commits without touching the working tree.
git tag <version_number>
Create a new tag with the specified version number
git branch -a --contains <commit>
List all branches that contain commit <commit>, including remote branches.
git checkout --theirs <pathname>
Resolve a merge conflict by accepting the "incoming" branch changes
git config --global user.name <username>
Set the global username for git
git grep -i "search pattern"
Search for patterns in the repository, ignoring the case of the search pattern
git pull --rebase
Rebase the remote branch into the local one
git reset --hard
Discard all changes and revert to the commit specified
git reset --soft HEAD~1
Reset the current branch and move the HEAD pointer to the previous commit, keeping the changes staged.
git reset <commit> --merge
Undo commits without touching the working tree.
git tag <version_number>
Create a new tag with the specified version number