Git operation collection

Git operation collection

The xxx mentioned below is the operation file or branch name

  1. Modify the local code and submit it to the remote warehouse
    git add xxx
    git commit -m 'xxxx'
    git push -u origin master


  2. Delete the file git rm xxx in the local folder

  3. Create a branch
    git branch xxx

  4. View branch
    git branch -v

  5. Switch branch
    git checkout xxx

  6. Merge branch
    git merge xxx

  7. View historical log information
    git log
    git log --oneline (brief information)

  8. Locally delete the merged branch
    git branch -d xxx

  9. Locally delete unmerged branches
    git branch -D xxx

  10. Delete the branch in the remote warehouse
    git push origin -d xxx

  11. Associated to the remote library
    git remote add origin xxx

  12. 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

  13. If the normal push fails, you can use this command to overwrite the branch:
    git push -u origin master -f

  14. View the creation and deletion of the latest branch on the remote side and synchronize it to the local
    git remote update origin --prune

Guess you like

Origin blog.csdn.net/qq_41821963/article/details/119783547