Git operation collection
The xxx mentioned below is the operation file or branch name
-
Modify the local code and submit it to the remote warehouse
git add xxx
git commit -m 'xxxx'
git push -u origin master -
Delete the file git rm xxx in the local folder -
Create a branch
git branch xxx -
View branch
git branch -v -
Switch branch
git checkout xxx -
Merge branch
git merge xxx -
View historical log information
git log
git log --oneline (brief information) -
Locally delete the merged branch
git branch -d xxx -
Locally delete unmerged branches
git branch -D xxx -
Delete the branch in the remote warehouse
git push origin -d xxx -
Associated to the remote library
git remote add origin xxx -
Get the remote library and local synchronous merge (this step must be done if the remote library is not empty, otherwise the subsequent submission will fail)
git pull --rebase origin master -
If the normal push fails, you can use this command to overwrite the branch:
git push -u origin master -f -
View the creation and deletion of the latest branch on the remote side and synchronize it to the local
git remote update origin --prune