Note Commit type

5. 1. Rihanna

2. Fix a bug

E.g. There are some docs/documents/documentation for you.

4. Style: format (changes that do not affect code execution)

5. Refactor: Refactoring (code changes that neither add new features nor fix bugs)

6. Test: Add a test

7. Chore: Variation of the build process or chore

Git basic operations

1. View branches

git branch
Copy the code

2. Create and switch to a new branch

Git checkout -b branch name (eg: LAN /home)Copy the code

3. Create a branch without switching to the new branch

Git branch name (eg: LAN /home)Copy the code

4. Switch branches

Git Checkout branch name (eg: master)Copy the code

5. Merge branches. Merge the specified branch to the current branch

Git merge branch name (eg: LAN /home)Copy the code

6. Delete the branch

Git branch -d git branchCopy the code

7. Initialize the warehouse

git init
Copy the code

8. View the warehouse status

git status
Copy the code

9. Add the file to the cache

Git add <file>Copy the code

10. Submit it to the local warehouse

git commit -m 'Commit type: Committed message'
Copy the code

11. View the submitted log information

git log
Copy the code

12. Check the Git version

git relog
Copy the code

13. Clone from remote repository to local repository (using clone based on local repository without source code)

git cloneRemote warehouse addressCopy the code

14. Pull the latest code from the remote repository (if the local repository has source code, use pull)

Git pull Origin Default branchCopy the code

15. Push local repository code to remote

Git push origin (eg: LAN /home)Copy the code

Merge the pull Request (in case of conflicts), where the dev branch is the default branch

1. In base branch (default branch eg:dev), pull the latest code (if not base branch, go back to base branch first)

git pull origin dev
Copy the code

2. Switch to your branch

git ckeckout lan/home
Copy the code

3. Foundation benchmark (at this point there will be a hint like (1/3), this is a conflict that needs to be resolved)

git rebase dev
Copy the code

4. Enter the code at this point and start resolving conflicts between the local and online dev branches (the latest code just pulled down)

5. Add the modified file to the cache

git add -A
Copy the code

6. This step will disappear if the conflict is resolved (1/3). If not, repeat steps 4,5 and 6 until the conflict is resolved

git rebase --continue
Copy the code

7. Code for your own work branch on your own work branch pull line

git pull origin lan/home
Copy the code

8. Enter the code at this point and start resolving conflicts between your local work branch and the online work branch (the latest code from the work branch you just pulled down)

9. Add the modified file to the cache

git add -A
Copy the code

10. Submit it to the local warehouse

git commit -m 'Commit type: Committed message'
Copy the code

11. Push local repository code to remote

git push origin lan/home
Copy the code

12. At this point you can restart merging work branches to dev online (conflict resolved)