Antecedents feed

Git flow is the main project of the project team I work for. In practice for a long time, I found that the logic of Git flow rules was complicated, which could not well adapt to the rapid iteration of the project, and it was difficult to maintain and manage. Therefore, in order to improve the working process of the project team, AFTER learning github Flow, GitLab Flow and other excellent workflows, I have explored my own workflow method in the attempt, and I would like to share it with you here.

reference

  • Git Flow, Github Flow, and GitLab Flow

  • The github Flow article introduces the project team’s own Workflow

Process characteristics

This workflow needs to fit the following requirements of the current project:

  1. Fast version iteration
  2. Facilitate stable code deployment and distribution
  3. Better error traceability and fewer systematic process errors
  4. Clear code review

practice

The following process is demonstrated in gitLab

  1. First of all, in the project teamgroupBuild a new warehouse in. Let’s say our project team is calledfront-end-team. Our warehouse is calledtest-project. We callgroupIn thetest-projectWarehouse forThe main warehouse. The main warehouse havemasterdevelopTwo branches.
  • Our usual development, pulldevelopBranch, newfeatureBranch, merged into after development is completemasterBranch, if there is a bug problem inmasterBranch on the basis of newhotfixBranch, try specific case merge after repairmasterdevelop
  1. Fork the main warehouse into a personal warehouse in GitLab
  • The Fork repository is completely your own, and you can make any changes to the repository code and configuration, but unless you submit a pull Request to the project repository and it is accepted, you can merge the code you Fork into the repository without affecting the repository.
  • In general,pullCode, need to pull the latest code from the main repository;pushIf so, it can only be strictly pushed to the individual’s sub-warehouse. Permissions need to be assigned in GitLab.
  1. Clone personal repository to local and upstream in remote configuration
  • upstreamPoints to the remote main warehouse address
  • originPoint to the remote personal warehouse address
Git remote add upstreamGit remote -v (" origin "and" upstream"
git remote -v
Copy the code
  1. Maintain personal storage andupstreamsynchronous
  • Note here that it is recommended that daily development work begin before it willupstreamUpdate the code locally
Upstream to local
git fetch upstream
git checkout master
git merge upstream/master # no -- ff
Sync local and remote personal repositories
git pull origin master
Copy the code
  1. Start a new feature or bug fix
  • Developing new featuresdevelopOn the newfeature/new-feature temporarybranch
  • Bug fixmasterOn the newhotfix/new-bug temporarybranch
# new features
git checkout -b feature/new-feature develop
New bug #
git checkout -b hotfix/new-bug master
Copy the code
  1. After the completion of the development submitted to the personal remote warehouse before synchronizationupstream
"> < span style =" font-size: 10.0pt; line-height: 20px; Bash git checkout develop git pull upstream develop # feature/new-feature.. Develop # assuming the console has output (see below), That local feature branch behind the develop branch of upstream commit 58 fae9f9355a820da713e830b0b4c8100bcb6dab (upstream/develop, develop) an Author: xxx <[email protected]> Date: Sun Sep 27 15:13:42 2020 +0800 > ❗ git rebase develop # bash git checkout feature/new-feature 💪 ' 'bash git push origin' - $git push origin - $git push origin - $git push origin - $git push origin - $git push origin - $git push origin Git push origin feature/new-feature 'Copy the code
  1. initiatepull requestmerge request
> -github 👉 pull Request > -gitlab 👉 merge Request > 1. On the ** personal ** repository page of 'gitlab', click 'Merge Request' from the left menu (👋 remember ** personal ** repository)! [](https://p9-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/05707564bda0481c93965634d76f83bf~tplv-k3u1fbpfcp-zoom-1.image) > 1.  Click on the green button 'New Merge Request'! [](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/e2614f3829a54a3282654bf3051c3d26~tplv-k3u1fbpfcp-zoom-1.image) > 1.  Left 'Source branch' select 'feature/new-feature' branch > 1. The right ` Target branch ` choose * * * * Lord warehouse ` develop ` branch (👋 remember is * * * * warehouse)! [](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/6f0a8ab1e12d46fe8847f0179bd24161~tplv-k3u1fbpfcp-zoom-1.image) > 1.  Then click assignee to select your name! [](https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/9f6f184caeb64df698d7db7d0d9317dd~tplv-k3u1fbpfcp-zoom-1.image) > 1.  Click on publish your 'PR'Copy the code
  1. Modify and submitPR
> - After your PR is published, others can check out branch to view and modify your PR. You can also make your own changes locally and submit them to the appropriate 'feature' branch. > - When all the problems are resolved, you can click the 'Merge' button to submit. [](https://p6-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/5d483d402d9c4b6a9006d30910b1d768~tplv-k3u1fbpfcp-zoom-1.image)Copy the code
  1. Finally, mergeupstreamoriginwarehouse
> - Origin does not have a 'feature' branch on it, but the 'feature' branch still exists locally. Bash git remote prune Origin bash git remote prune OriginCopy the code