Reputation: 504
I am in the process of developing a Git workflow for a web app project I am working on. I have used Git for several years, but only as a solo developer. I have put a set of procedures together, and yesterday ran across this article on HN: http://sandofsky.com/blog/git-workflow.html
Based on the article I have adjusted my procedures and would appreciate some feedback. I want to make sure I am interpreting the article correctly and not contributing to issues down the road. Based on the article in question, and the desire to provide good working standards, are there any issues with the following procedures?
Branch: master
Branch: staging
Branch: production
Upvotes: 4
Views: 2410
Reputation: 1323115
You wrote:
If changes in '
dev_newfeaturename
' branch are more complex, requiring multiple commits to remain in the history:
- Switch to ‘
dev_newfeaturename
’ branch:git checkout dev_newfeaturename
- Reintegrate any changed ‘
master
’ code into ‘dev_newfeaturename
’ branch:git rebase --interactive master
- To cleanup history by combining commits, change the operation from "pick" to "squash", which squashes the second commit into the first
- Switch to ‘
master
’ branch:git checkout master
- Push changes to remote ‘
master
’:git push origin master
I think you forget the fast-forward merge of 'dev_newfeaturename
' into ‘master
’:
The rebase allows you to replay 'dev_newfeaturename
' on top of ‘master
’, cleaning up the commits in that process. That is good.
But if you want to push back master to the remote, master needs those cleaned commits in its history: `git merge dev_newfeaturename
Regarding a branch per development state (staging, prod), I wouldn't recommend that approach, unless you are actively producing new commits in those branches.
Remember the sentence about no-ff in the article you reference:
The only remaining argument for
–no-ff
is “documentation.”
People may use merge commits to represent the last deployed version of production code.
That’s an antipattern. Use tags.
Upvotes: 5