Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to categorize git commits?

We have two separate projects on two different domains. Let's assume A project (the main) and B project. Sometimes we need to use some specific feature that we have already launched on the A project on the B project with the git cherry-pick command, but there is a problem in this process:

How can we find easily related commits among thousand of our commits on the GitLab site? We are looking for a way for sticking a searchable label on our commits that specifies which commit is proper for the A project and which one for both of them. We cannot search and find those commits with labeling toward the merge request process (at gitlab.com).

like image 386
S. Hesam Avatar asked Apr 08 '26 00:04

S. Hesam


2 Answers

In my shop, this is managed through commit message prefix, using the Jira ticket ID.

Each feature is implemented with a reference to a Jira ticket, and importing feature from one projet to another can be done a range of commit based on their commit message prefix.

Beware of the inconvenients of cherry-picking though.

In your case, the code cherry-picked from A to B might depend on other code from A not present in B.

like image 167
VonC Avatar answered Apr 10 '26 23:04

VonC


GitLab isn't where you do your main work, it's where you publish it. Anything beyond the basics you do in your local repo. Searchable labels on commits sounds like Git's notes facility, "A typical use of notes is to supplement a commit message without changing the commit itself". It's the building blocks of a general labelling/searching facility, whatever you want for consequences to annotations you get to implement yourself. I have no idea what the GitLab merge mentioned here actually implemented, but they certainly know about it and people do use it for things like what you're describing.

like image 34
jthill Avatar answered Apr 10 '26 23:04

jthill



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!