Only one commit per MR

Hello everyone!
I recently joined as an applicant and i’m in the immersion process, but i have big problems doing Merge request to Gitlab. I tried to follow the instructions and use the template for the commit message, but it doen’t work, it must be i’m missing something that i’m not reading or something like that. I need some help with that part of the training. I’m not looking for the answer, just some advice. Thanks!

What errors are you getting? Did you read them? Did you try to fix them?

We can’t give you any advise/help when your post doesn’t address a specific problem.

Sorry, this is what it says:

⧗ input: sol(code): #0 codeabbey, 1 (1.0)

  • others: 28 in, 6 out, 34 total.
  • score: 0 initial, 1 final, 1 progress.
  • global-rank: 22112 initial, 22112 final, 0 progress.
  • national-rank: 22112 initial, 22112 final, 0 progress.
  • effort: 4 hours during immersion, productivity 0.25 points/hour.
    :heavy_multiplication_x: body must have leading blank line [body-leading-blank]
    :heavy_multiplication_x: found 1 problems, 0 warnings
    (Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )

I don’t see any problem with the commit message at first glance, however, here are some tips that can be useful to avoid common mistakes with commits and MRs and may be related to your error:

  • squashing/rebasing commits: always work on a single commit per challenge and MR.
  • local-builds: make sure that everything’s ok before pushing your commit to the repo, in this case, you can run commitlint locally in every commit by using npm install, sometimes there are tricky bugs in commit messages such as EOFs and special chars that are difficult to debug from the repo CI but easy to find locally, you save time and effort.
  • Checking CI logs: sometimes CI errors are really simple and you can find out what’s wrong just by checking the logs, the error messages are explicit and often contains the solution.

Hope it helps.

Regards

What editor are you currently using? Some editors add metacharacters to the commit message, making commitlint fail. Try using Vim.

Also, are you leaving a blank line between the commit title and commit body?

Better yet, can you attach a code section with the commit message exactly as you send it from your editor?

I’m using vscode for editing.
The commit message is exactly as it shows in the reply, i took it from the /commit-msg-challenges.txt template.
I sent the commit message with Gitlab UI, maybe that is the problem?

Probably is missing a new line at the end of the commit message.

It’s easier if you send the gitlab URL with the CI log!

https://gitlab.com/autonomicmind/training/-/jobs/253578934

I still don’t know whats the issue, it says the rule is body-leading-blank, i googled thet and i found the body must have a blank line at the leading but i already did that, this is the message i sent with the commit:
sol(code): #0 codeabbey, 1 (1.0)

  • others: 28 in, 9 out, 37 total.
  • score: 0 initial, 1 final, 1 progress.
  • global-rank: 22112 initial, 22112 final, 0 progress.
  • national-rank: 22112 initial, 22112 final, 0 progress.
  • effort: 4 hours during immersion, productivity 0.25 points/hour.

This is the only error that i got with the test.

Your branch is currently 8 commits behind and 19 ahead of master. That cannot be. The last commit message seems ok, but maybe others are interfering. Fix your branch so it is only 1 commit ahead of master, try again and maybe that will fix the issue.

2 Likes

Make sure to do what @roaring-lamport just said. Also I just tried a commit with the following commit message:

sol(code): #0 codeabbey, 1 (1.0)

- others: 28 in, 9 out, 37 total.
- score: 0 initial, 1 final, 1 progress.
- global-rank: 22112 initial, 22112 final, 0 progress.
- national-rank: 22112 initial, 22112 final, 0 progress.
- effort: 4 hours during immersion, productivity 0.25 points/hour.

And it passed the checks. So, in case you keep getting the same error, consider changing the editor you use for commits.

@infinite-loop is it possible that ursula check that situation (several commits ahead of master) and signal explicitly with an error message?

And how can i fix that? i mean do i have to revert thoose commits by once? or how can i fix my branch?

Read about git reset, hard reset, git in general. Thats part of this trip, to figure out for your self how to handle this kind of situations.

Solving that is an important part of the challenges and you need to solve it on your own.

Ok thanks for your help, i’m trying to solve it right now!

Actually, Ursula does check this, but doesn’t break the build as non-training MR’s can have more than 1 commit. Here is an example:

Regarding commits behind master, we usually deal with this by rebasing from the UI.

I got it, so the multiple commits was the main cause of the error, thanks for the help! Merge request done!

Could Ursula break the build in this situation based on sol(XX) type?

Yes she could! Opening issue on both training and writeups.