git init
- Initialize a new Git repository.git clone <url>
- Clone (download) a remote Git repository locally.git add <file>
- Add files to the staging area.git commit -m <message>
- Commit changes to the staging area and add commit messages.git status
- View the status of the working tree and staging area.git diff
- See the differences between the current file and the last commit.git branch
- List all branches, the current branch will be marked with an asterisk.git checkout <branch>
- Switch to the specified branch.git merge <branch>
- Merge changes from the specified branch into the current branch.git remote add <name> <url>
- Add the alias and URL of the remote repository.git fetch <remote>
- Get latest references and objects from remote repository.git pull <remote> <branch>
- Get latest changes from remote repository and merge into current branch.git push <remote> <branch>
- Push changes from the current branch to the remote repository.git log
- View commit log.git reset <commit>
- Roll back to the specified commit.git stash
- Saves current changes and resets the working tree to the state of the last commit.git tag <tagname>
- Create a new label.git cherry-pick <commit>
- Select a commit and apply it to the current branch.git rebase <branch>
- Reapply changes from the current branch to the specified branch.git remote -v
- Show details of remote repository.git show <commit>
- Show commit details and changes.git rm <file>
- Delete files from Git.git mv <old> <new>
- Rename or move files.git blame <file>
- Show file modification history line by line.git config --global user.name <name>
- Configure global username.git config --global user.email <email>
- Configure global user mailbox.git cherry-pick --continue
- Continue the cherry-pick operation where it was interrupted.git reflog
- View the ref log, including deleted branches and reset operations.git revert <commit>
- Undo the changes of the specified commit.git clean -n
- Shows untracked files that will be deleted.git bisect start
- Start a binary search (used to locate the commit that introduced the bug).git bisect good
- Mark the current commit as "good" (no errors).git bisect bad
- Mark the current commit as "bad" (has bugs).git bisect reset
- Terminate binary search and reset HEAD to initial state.git log --graph
- Display commit history graphically.git blame -L <start>,<end> <file>
- Display the modification history of the specified range of the file line by line.git stash apply
- Apply recently saved stash and retain stash contents.git stash drop
- Discard recently saved stash.git tag -a <tagname> -m <message>
- Create a label with annotation.git checkout -b <new-branch>
- Create a new branch and switch to it.git reset --hard <commit>
- Resets the current branch to the specified commit and forces an update of the working tree.git push <remote> :<branch>
- Delete the specified branch on the remote repository.git grep <pattern>
- Search version history for files and content matching patterns.git log --author=<author>
- View posts submitted by a specific author.git diff <commit1>..<commit2>
- View differences between two commits.git revert --no-commit <commit>
- Undoes the changes of the specified commit, but does not automatically create a new commit.git bisect next
- Switch to the next commit during binary search.git rebase -i <commit>
- Interactively rebase commits after the specified commit.git config --global core.editor <editor>
- Configure the text editor used globally.git push --tags
- Push all tags to remote repository.git log --grep=<pattern>
- View logs for commit messages containing specific patterns.
50 commonly used Git commands
Guess you like
Origin blog.csdn.net/qq_53873381/article/details/132175067
Recommended
Ranking