Reputation: 61
In our gitlab commit messages we use some standard strings to trigger our builds and other analysis.
After some time obviously our git history will become full of these useless messages. Is there any way to make some cleanup of our git histories?
Upvotes: 2
Views: 120
Reputation: 2778
If you do those commits on a Personal/environment/feature branch, you just need to do a SQUASH COMMIT when merging to a common branch like for example master
is.
Squashing lets you tidy up the commit history of a branch when accepting a merge request. It applies all of the changes in the merge request as a single commit, and then merges that commit using the merge method set for the project.
So, every merge you do on a new branch in the Squash way, will be completely clean.
EDIT FOR RECCOMENDATION:
I strongly reccomend to you to follow good practices when creating your branches and project different versions. This is called the Gitlab flow. This will help you avoiding crazy "commit deletes" and will allow you to clarify your development procedure.
If you see this URL, the trick of mapping, for example, branches with environments or features, helps doing things much more clearer. Also, when you commit to a "higher level" branch, you squash commit and clean the original branch, as It's unneded.(If you are following a good DevOps path, if your branch is being merged, it should be fully tested and functional. That's what you are looking for with gitlab-ci).
Also, I've found this part of the document that goes deeper explaining how Squash commits work on Gitlab flow.
Upvotes: 2