Hyston blog
About • Archive • RSS

What I have learned about git today

2019-12-30 07:12

I knew about git hooks, but never actually used them. The first and obvious thing, that I could imagine — add branch name to git commit message. .git\hooks\ contain nice examples to start, but I was taken aback by amount of bash scripting, that is required. And, more importantly, it seems that it never works properly — neither Sourcetree or fork.git client were showing changes. However, after commit pre_commit_message hook was actually executed and branch name was inserted correctly. Examples like this should work flawlessly to my purpose. And I need to learn bash too 😶
Apparently, branching workflow, that we use at work, has a name. It's called gitflow (insert link), and it is used in many projects and even in our teams is proved as very convenient and easy solution. It is well described here and I can only describe one difference in how we use it: usually we do not merge release branch back to development (as well as hotfixes). All changes for current release accumulates in release branch, then we merge to master and only after deployment merge it back. 1 There is no harm to not merge release back into dev (as well as every hotfix), but it can be overlook and forgotten, but during deployment process it's just one step in list of instructions.

  1. The only exception — when release contain new migration, then it should be merged asap. Then I would be better to add migration to feature branch (even is feature is already merged to development and release) and, merge feature branch to development and release branch accordingly

Next entry → ← Prev entry