git config |
Configure Git settings. |
git config --global user.name "Your Name" |
Set your name for Git. |
git config --global user.email "[email protected]" |
Set your email for Git. |
git config --global color.ui true |
Enable color output. |
git init |
Initialize a new Git repository. |
git clone <repository url> |
Clone an existing repository to your local machine. |
git status |
Show the status of your working directory and staging area. |
git add <file> |
Add a file to the staging area. |
git commit -m "Commit message" |
Commit changes in the staging area with a message. |
git branch |
Show a list of all branches in the repository. |
git branch <branch name> |
Create a new branch with the given name. |
git checkout <branch name> |
Switch to the branch with the given name. |
git merge <branch name> |
Merge changes from the specified branch into the current branch. |
git remote -v |
Show a list of all remote repositories. |
git remote add <remote name> <remote url> |
Add a new remote repository. |
git push <remote name> <branch name> |
Push changes to the remote repository. |
git pull <remote name> <branch name> |
Pull changes from the remote repository. |
git log |
Show a log of all commits in the repository. |
git diff |
Show a diff of all changes made since the last commit. |
git stash |
Temporarily save changes without committing them. |
git reset |
Unstage changes in the staging area. |
git revert <commit hash> |
Undo changes made in a specific commit. |