3

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).

4
  • 1
    Can't just devise a commit message or tag keyword protocol? For example, Jira detects commits and links them to work tickets by ticket ID in the commit message. Commented Mar 5, 2021 at 22:14
  • @isherwood We need to find those commits on GitLab easily, Is this method suitable for our purpose? Commented Mar 5, 2021 at 22:17
  • Does this answer your question? How to label or categorize git commits Commented Mar 6, 2021 at 11:10
  • @GinoMempin Unfortunately, not. Commented Mar 6, 2021 at 15:30

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

0

You can sign your commits with the #A-project prefix on your commit message then easily search your desired commits on Gitlab with a commit message.

1 Comment

So... the same general idea I was mentioning in my answer? A commit message prefix?
0

In my company my team works with 5 customers at the same time, so we found a way to cherry-picking/merging a feature from one to another using tags to identify versions, changes, or a set of commits that need to be "copied". Unfortunately, GitLab is not the best or recommended tool to work with this kind of git operation.

To know more about Tagging: https://git-scm.com/book/en/v2/Git-Basics-Tagging

I'd recommend you try using another tool like Git Tortoise (easy and extremely powerful) if you're using Windows. But if say this for you don't convince you, then I'd give you a tip to put some kind of pattern in the description of your commits to simply search for them later (It's not recommended).

To download some GUI Client for Git: https://git-scm.com/downloads/guis

There are a lot of good GUIs free for Linux, Windows and MacOS.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.