git init |
Initialize a new Git repository. |
|
git clone [url] |
Clone a repository from a URL. |
|
git add [file] |
Stage changes to a file. |
|
git commit -m "[message]" |
Commit changes with a message. |
|
git status |
Show the working tree status. |
|
git pull |
Fetch and integrate with another repository or a local branch. |
|
git push |
Update remote refs along with associated objects. |
|
git branch |
List, create, or delete branches. |
|
git checkout [branch] |
Switch to a specified branch. |
|
git merge [branch] |
Merge a branch into the current branch. |
|
git log |
Show commit logs. |
|
git diff |
Show changes between commits, commit and working tree, etc. |
|
git reset [file] |
Unstage a file while retaining its changes. |
|
git rm [file] |
Remove a file from the working directory and the index. |
|
git stash |
Save changes temporarily to a stack. |
|
git stash apply |
Apply changes saved in the stash. |
|
git stash drop |
Remove a stash entry. |
|
git tag [name] |
Create a new tag. |
|
git fetch |
Download objects and refs from another repository. |
|
git remote -v |
List the remote connections. |
|
git remote add [name] [url] |
Add a new remote repository. |
|
git remote remove [name] |
Remove a remote repository. |
|
git cherry-pick [commit] |
Apply changes from a specific commit. |
|
git rebase [branch] |
Reapply commits on top of another base tip. |
|
git rebase --continue |
Continue rebasing after resolving conflicts. |
|
git rebase --abort |
Abort the rebase process. |
|
git merge --abort |
Abort the merge process. |
|
git commit --amend |
Modify the last commit. |
|
git log --oneline |
Show a brief log of commits. |
|
git reflog |
Show reference logs. |
|
git show [commit] |
Show various types of objects. |
|
git config --global user.name "[name]" |
Set a name for your Git configuration. |
|
git config --global user.email "[email]" |
Set an email for your Git configuration. |
|
git config --list |
List all Git configuration settings. |
|
git clean -f |
Remove untracked files from the working directory. |
|
git tag -d [tag] |
Delete a tag. |
|
git log --graph |
Display a graphical representation of the commit history. |
|
git diff --cached |
Show changes staged for the next commit. |
|
git blame [file] |
Show what revision and author last modified each line of a file. |
|