Some specification sharing accumulated from the former company during development, including Git branch recommendation specification and front-end project online packaging process, etc.

Git Git

Update content from remote library to local

git pull
Copy the code

Add the file to the buffer

Git add. // Add all filesCopy the code

Delete the file

git rm <filename>
Copy the code

Send all changes to the repository for the buffer

git commit -m "Submit comments"
Copy the code

Check the status of the Git repository

git status 
Copy the code

Compare file differences

git diff <filename> 
Copy the code

View the Commit Log

git log
Copy the code

Switch branch

Git checkout -b <branchName> git checkout -b <branchNameCopy the code

Merges the contents of a branch into the current branch

git merge <branchName> 
Copy the code

Git branch management specification

Master the main branch

As an official environment branch (stable version), it is read-only, cannot be modified, and can be merged

The formal server should switch to this branch

Release The pre-publish branch

As an acceptance environment branch, it cannot be modified and can be merged

Switch to this branch before acceptance or formal server online

Develop test branch

As a test environment branch, it can be modified and merged

The test server should switch to this branch

Feature/development (feature) branch

As a development environment branch, the local development and development server should switch to this branch

Hotfix/BUG fix branch

As a BUG fix branch, pull a Hotfix branch from the online or test branch and merge it into the test or online branch after the BUG is resolved

Git workflow model recommendation

Front-end project on-line process specification

The test environment

Git merge feature/<name> // merge branch/git pushCopy the code
Server - git pull - NPM run buildCopy the code

Formal/Acceptance environment

-git checkout master /<name> -git checkout master /<name  merge develop - git pushCopy the code
Server - git pull - NPM run buildCopy the code

Thermal repair process

-git checkout master -git checkout -b hotfix/<name> -git push origin hotfix/<name>:hotfix/<name> // Git checkout master - git push hotfix/<name> -git pushCopy the code
Server - git pull - NPM run buildCopy the code