Git Workflow: Refining and Removing Obstacles

I am developing a Git workflow for a web application project that I am working on. I used Git for several years, but only as a solo developer. I gathered a number of procedures and looked through this article on HN yesterday: http://sandofsky.com/blog/git-workflow.html

Based on the article, I adjusted my procedures and will be grateful for some feedback. I want to make sure that I am interpreting the article correctly and not introducing problems in the future. Based on this article and the desire to ensure good working standards, are there any problems with the following procedures?


The basics

  • the main branch is the main, working branch, which includes all the code development merges. These are the latest additions to the code base from individual development branches.
  • 'dev_' . Local, private development branches should be used to develop new features. If you need to direct the branch to the server (so that you can easily switch between computers), make sure that the dev name branch includes the username, for example 'dev_andy_authentication'.
  • intermediate branch . Before deploying specific code from the master branch, the code must be tested in an environment that matches the environment as closely as possible. The code from the main branch merges into the intermediate branch, is checked and, after passing the tests, is eligible for production.
  • production branch . Stable code from the intermediate branch is integrated into the production branch, marked with the release version number, and then deployed to the production server (s).

Development

Branch: master

  • Use local, private function branches to split the code:
    • Switch to main branch: Git validation wizard
    • Create a new private function branch: Git checkout -b dev_newfeaturename
    • Add feature enhancements.
    • Changes to the scene: Git add.
    • Commit changes to 'dev_newfeaturename: Git commit -m "commit description"
  • To integrate changes from the dev_newfeaturename branch:
    • Switch to main branch: Git validation wizard
    • Check remote changes for "master: Git pull --rebase origin master
    • If the changes in the dev_newfeaturename branch are relatively small:
      • Integrate changes from dev_newfeaturename branch to master: Git merge --squash dev_newfeaturename
      • Write a detailed message about the changes made from the dev_newfeaturename branch: Git commit -v
    • If changes to the 'dev_newfeaturename' branch are more complex, many commits are required to stay in history:
      • Switch to dev_newfeaturename branch: Git checkout dev_newfeaturename
      • Restore any changed "master code" to dev_newfeaturename: Git rebase --interactive master branch
      • To clear history by combining commits, change the operation from “pick” to “squash”, which issues a second commit to the first
      • Switch to main branch: Git validation wizard
      • Push changes to the remote wizard: Git click the initial wizard
    • Check remote changes for "master: Git pull --rebase origin master
    • Push all changes in the "master" to the server: Git click the initial master
  • 'The wizard becomes the working tree of all currently existing functions.
  • Periodically pull "main changes from the remote: Git pull --rebase origin master

Phased

Branch: Stage

  • Once you plan to release a certain number of bug fixes / corrections, make sure that "the wizard works correctly and then merges into" by:
    • Switch to "intermediate branch": Git verification phase
    • Integration of changes from the "master to" stage: Git merge --no-ff master
    • Pressing 'for remote repo: Git push origin staging
  • Deploy the staging branch to the staging server and thoroughly test the staging server to maximize your production environment.
  • If any testing fails, return to the "leading branch", fix the related problems and restart the setup process.
  • If all testing passes, go to the Production Process.

Products

Branch: Production

  • After the code in the intermediate branch has been tested and passed, switch to the production branch: Git statement production
  • Integration of changes from production to production: Git merge --no-ff staging
  • Tag Code with Serial Release Version Number: Git tag -a 0.1
  • Push 'production for remote repo: Git push origin production
  • Deploy the production branch to the production server and verify to ensure proper deployment.
+4
source share
1 answer

You wrote:

If changes to the ' dev_newfeaturename ' branch are more complex, several commits in the history are required:

  • Switch to dev_newfeaturename branch: git checkout dev_newfeaturename
  • Recover any modified master code in dev_newfeaturename : git rebase --interactive master
  • To clear history by combining commits, change the operation from “pick” to “squash”, which issues a second commit to the first
  • Switch to master branch: git checkout master
  • Push changes to remote ' master : git push origin master

I think you forgot the fast merge of ' dev_newfeaturename ' into ' master :
The rebase function allows you to play ' dev_newfeaturename ' on top of ' master , clearing commits in this process. It's good. But if you want to push the wizard to a remote computer, the wizard needs to clear it in its history: `git merge dev_newfeaturename


As for the branch to the state of development (staging, prod), I would not recommend this approach, unless you are actively creating new commits in these branches. Remember the no-ff suggestion in the article you are referencing:

The only remaining argument for –no-ff is "documentation."
People can use merge commands to represent the latest deployed version of production code.
This is an antipattern. Use tags .

+4
source

All Articles