git commands (commonly used)

git command

git init : initialize the git repository

git clone : ​​Clone the remote Git repository to local

git status : View the status of the file

git add : add all files to the staging area

git commit -m : Submit the contents of the staging area to the local warehouse, -m: Submit information

git push origin : push code to the remote warehouse

git diff : View the differences between the workspace and the staging area

git log : View commit history

git branch : Train all local branches

git brach -r : List all remote branches

git branch [branch-name] : Create a new branch and stay on the current branch

git checkout -b : Create a new branch and switch to this branch

git merge : merge branches

**git branch -d [branch-name] **: delete branch

git pull : Pull the code from the remote warehouse to the local warehouse

git reset : Pull the code of the local warehouse to the staging area

git checkout : put the code in the staging area into the working directory

git workflow

Working directory->Staging area->Local warehouse->Remote warehouse

git add->git commit -m->git push

Remote warehouse->Local warehouse->Staging area->Working directory

git pull->git reset->git checkout

Guess you like

Origin blog.csdn.net/qq_47944751/article/details/131589114