as part of my job i use to make deploys between our enviroments dev/test/prod
We use to manage our code with the well known branching flow, so we have the following branch:
dev -> where all branches get merged to as a single commit when a feature is implemented
test -> where we use to test our code by using the platform
master -> this branch is actually used only for creating tags which will be then used in our production server
Recently i wanted to find a way to keep the code history as clean as possible, but i'm struggling on how to do that easily.
i created a repository and reproduced a flow so that you can understand why i'm struggling
so, after the initial commit i created the 2 branches dev and test and switched to dev to make the following commits and made 3 commits:
9e76b6d - koop4: added anawesome feature that makes life easier
44976b1 - koop4: added anawesome feature that makes life faster
64ea9d3 - koop4: added anawesome feature that makes life brighter
I made a pull request to bring those feature in test and squash-merge them with a singe commit. I also like to paste as a comment the results of the git command
git log --pretty=format:"%h - %an: %s" test..dev
Sometimes it happens that more features go through this cycle until everything is ready for production. Let's avoid redundacy and let's move to prod with another pull request!
Note: in prod we use to use as commit message the tag name
We did it! We now have a super clean history in all our environment! Great!
So, what's the poblem? Let's now repeat the cycle by adding new commits in dev:
ca215e8 - koop4: this will make you shit your pants
9e76b6d - koop4: added a scary feature that make us freak out
let create the pull request and ...Wait...what??? Why does it says i m still missing these commits:
Ok ok, I understand the concept, but a this point I think you realized my struggling. To keep my history clean i have to pick by myself the commits i need:
and even repeat the process for our master pull request.
In the end with some plumbing i can get to a great history for all enviroments, but when things start to grow i struggle understanding which commits i have to put in the commit comment to keep it clean.
Is there anyone with suggestion to keep a clean history without having to struggle that much?