All the commands in this article are excerpted from "Git". For detailed online content, see
https://git-scm.com/book/zh/v2
.
git config # View or configure git
git init # Initialize warehouse
git status # View warehouse status
git add file1 ... # Add the file to the tracking area or put the tracking file in the staging area
git reset HEAD filename # Cancel the temporary file
git checkout -- filename # Undo the changes that have not been temporarily
saved git rm file1 ... # From the temporary Remove the file from the storage area, and also delete it from the working directory
git rm --cached file # Only remove the file from the temporary storage area
git commit -m "Instruction information" # Officially submit the update modification information
git commit -a # Skip Go through the "git add" step
git commit --amend # to resubmit, and the files in the staging area will also be submitted.
git mv file_from file_to # Move the file and track the file file_to instead
git clone repository address # Clone the remote warehouse
git diff # View the changes before and after staging
git diff --cached/--staged # View the changes that have been staged
git log [-n] # View the history of the last n commits
git log - p # View the submitted content differences
git log --pretty=[oneline/format:"%h - %an, %ar : %s"] # Output the commit history in the specified format
git remote # List the configured remote warehouse servers The abbreviation of
git remote -v # will also list the url corresponding to the remote warehouse
git remote add shortname url # Add a remote warehouse, and specify a shorthand to represent the url
git fetch shortname/url # Pull the remote warehouse data (not automatically Merge)
git pull repository # Pull remote warehouse data (will try to merge automatically, more commonly used)
git push repository branchName # Push to remote warehouse (but make sure there is no conflict)
git remote show repository # View remote warehouse information
git remote rename oldName newName # rename remote repository
git remote rm repository # Remove remote repository
git tag [argument] # View or type various tags
git push remoteRepo --tags # Push all tags to remote repository (default "git push" will not push)
git config --global alias .aliasName command # Define an alias for the command
git branch branchName # Create a branch
git branch -d branchName # Delete branch
git log --decorate # View what each branch currently refers to
git checkout branchName # Switch branch
git checkout -b branchName # Create And switch to the branch
git merge branchName # Merge the branch branchName with the current branch
git basic command shorthand
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326085597&siteId=291194637
Recommended
Ranking