This is the 26th day of my participation in the August Text Challenge.More challenges in August
In addition to Git triple connection, what are the common operations in actual work
Git checkout– Create, switch branches, forgo local modifications
The checkout command is often used for branch operations, while supporting operation creation of local files and switching to a new branch:
Git checkout -b <branch> // create and switchCopy the code
Discard changes to a file:
Git checkout <file> git checkoutCopy the code
Git reset– Rollback of a historical version
Another feature of Git is the flexibility to manipulate historical versions. With the advantage of decentralized repositories, historical versions can be manipulated without affecting other repositories. Back to a historical commit:
Git reset --hard <commit> // Rollback to a version and rollback to the fileCopy the code
Git merge– Merge branches
The merge command is used to merge the development branch code into the test or trunk branch.
Git merge <branch> // Merge a branch into the current branchCopy the code
What happens when Git pull happens?
Many people do not understand the difference between Git pull and fetch. In fact, when Git pull is executed, there are two steps: one is fetching fetch and automatically merging merge, while fetching supports simple fetch execution and does not automatically merge. Here’s an example:
Git diff temp // Git merge temp // merge TMP //Copy the code
Modify the file, suddenly found that the branch is wrong, how to do?
Sometimes we make changes to a file and realize that the branch forgot to cut back to the development branch. Is there a better way to do this than clumsily copy the file, switch back to the correct branch, and then restore the code? After implementing the Git Stash temporary change to cache, switch to the correct branch and push the change out of the stack:
Git stash pop: <branch>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 official server should switch to this branch
Release The pre-publish branch
As an acceptance environment branch, it cannot be modified and can be accepted by Merge or switched to this branch before a formal server is put online
Develop test branch
As a test environment branch, it is modifiable and can be merged test servers 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
Welcome to other articles
- Internationalize your website with Vite2+Vue3 | August Update Challenge
- Actual combat: The front-end interface request parameters are confused
- Practice: Implement a Message component with Vue3
- Actual combat: Vue3 Image components, incidentally support lazy loading
- What updates does One Piece, vue.js 3.0 bring
- An article digests the major new features of ES7, ES8, and ES9
- Common problems and solutions for technical teams
- Introduction to 10 common new features in ES6
- Vue3 script Setup syntax is really cool