The flow chart

branch

  • Create a branch

    1. Creating a local branch
    Git branch dev git checkout devCopy the code
    1. Pull the remote branch
    Git checkout -b git checkout -b git checkout -b git checkout -b git checkout -bCopy the code
  • See the branch

    Git branch -rCopy the code
  • Delete the branch

    1 Switch to another branch first: 2 Run the following command to delete the local branch: git branch -d dev 3 Run the following command to delete the remote branch: git push origin --delete devCopy the code
  • Merging branches

    Cut back to the main branch and merge

    Git merge dev git merge devCopy the code

Move out and move in of committed information

If the current change is not complete, but there are other urgent projects to change, how to save the current change without affecting the current branch. Use git stash


Start by adding to the staging area with git add

  1. Storage modification. When storing, add remarks for easy search. If only Git Stash is available, it is not easy to identify when searching.
git stash save "save message" 
Copy the code
  1. Check out what stash stores are
git stash list 
Copy the code
  1. Should be stored
  • By default, the first stash is used, stash@{0}. If you want to use the other stash stash apply stash@{$num}. For example, the second: git stash apply stash@{1}
git stash apply 
Copy the code
  • Command to restore the previously cached working directory, remove the corresponding stash from the cache stack, and apply the corresponding change to the current working directory. The default is the first stash, namely stash@{0}. If you want to apply and delete other stash, run the following command: Git stash pop stash@{$num}, for example, apply and delete the second one: git stash pop stash@{1}
git stash pop 
Copy the code
  1. Delete the
  • Discard the stash@{$num} store and remove the store from the list
git stash drop stash@{$num} 
Copy the code
  • Remove all cached Stash
git stash clear 
Copy the code

Check the information

Git statusCopy the code

Version rollback

Git reset --hard <commit idCopy the code

tagging

Git tag <tagnameCopy the code
  • Release specification

    Tags include 3-bit versions prefixed with v. Such as v1.2.1. Tag naming conventions: Use bit 2 for new feature development and bit 3 for bug fixes

  • Commit specification reference: blog.csdn.net/yanlaifan/a…