Different branches shown in the same remote branch - gitlab

I have a problem. I have wrongly merged the master branch in a minor branch. Now I have these two branches shown as one only branch into the gitlab repository which definitely not correct.
I need to separate these two branches as they were originally, the master branch (integration) and a test branch (playpen-jimi). Anything to suggest? thank you very much. Attached you will find a screenshot of the merged branches in the gitlab repository.
enter image description here

Related

Can't make a pull request

I have this repository that i forked from another one, and now i need to make a pull request to it, but it says that: "There isn’t anything to compare.", and my commits are not showing:
https://github.com/amorimll/desafio-sharenergy-2023-01
Any help is appreciated, really need this for today.
This is showing in the git rebase:
Short answer
will be checkout to your main branch get the lastest code, then go back to your current working on branch and do git rebase [currentBranchName] main
Explain
so when your create a branch from another branch, is like your created a snapshot code from that branch at that moment. ideally the branch you copied form should prevent make any more changes if possible, until you done working in the new branch and create the PR and done marge it.
what rebase command will do is in case the origin branch had changes, it will pull the latest code form that branch into your working branch first, then to applied any changes you was made for your current working branch. Usually this process will need have some conflict need to fix, if they changed the same file.
Hope this is help you understand :)

How to check current branch head compare to default branch in GitLab

GitHub web shows where is the selected branch compare to default branch. For example here dev is the default branch and I have selected qa branch. It shows that qa branch is 1 commit behind dev.
Does GitLab have the same kind functionality in UI.?
Sure!
Navigate to Repositories > Branches, the list of branches has an indicator (before status icon and Merge Request button)
once you hover above, it explains "N commits behind ... M commits ahead"
Clicking on Compare brings detailed diff in commits and files

Gitlab: How to setup squash on merge?

I want to setup the squash on merge policy in GitLab. This gif showcases exactly what I would like to have:
Merge Strategies
I have set the GitLab merge method to "Fast-forward merge" and the squash commits policy is set to mandatory when merging.
Once merge is done, the git log of the main branch is exactly like I want it. The feature branch commits were squashed and the whole feature appears as one commit in the git log.
Here's the problem:
The squashed commit that is now the head of the main branch has the timestamp of the last commit in the feature branch. I would expect it to be the timestamp of when the fast-forward merge happened (squash). Is there a way to set it up in GitLab?
The merge timestamp is important for me since I need to know when the feature made its way into the main branch. However, I want to keep the commit history streamlined and straightforward, so the default option with an additional merge commit for every merge is something I want to avoid.

How to concat commit messages with GitLab MR squash?

I am using GitLab MR to push commits to my project.
I have a certain template in my commit message that I want to keep on my target branch (e.g. master).
for example:
[Notes]:
when pushing several commits in a single MR we get something like this:
Commit 1: [Notes]: Note1
Commit 2: Merge commit (the one I want to get rid of when squashing)
Commit 3: [Notes]: Note2
when squashing with GitLab MR the squashed commit message is the title of the MR, which prevents me to keep my original commits template.
Is there an option in GitLab setting to change the squashed message to be a concat of all commit messages? similar to interactive rebase in git.
wanted behavior:
Squashed Commit: [Notes]: Note1
Merge commit (the one I want to get rid of when squashing)
[Notes]: Note2
GitLab 14.9.2-ee
I managed to find what I was looking for, it is a GitLab feature introduced in the FREE edition since GitLab 14.6.
Open GitLab website -> Settings -> General -> Merge requests -> Squash commit message template.
Then in the textbox add the following flag:
%{all_commits}
The commit messages are shown in the squash message according to their chronological order.
I do have this checkbox (see attached image) in my merge request enabling me to change the Merge Commit Message but I am using: 15.2.1-ee I'm not sure on what version this got introduced. I think there was a similar functionality in previous versions.

GitLab:Merge Request: If multiple MR into Develop but move only my changes to QA branch

There are multiple Merge requests merged into Develop but I want to MR only my changes from develop branch to the QA branch
/abc/abc.py ---|
/abc/deg.py ---|Changes merged into develop by other developer
/test.py ---|
/tss/tss.py ---|Changes merged into develop by me **( I want only these to move to next branch)**
Used cherry-pick to resolve the issue by selecting only the changes/commit you want to apply.

Resources