Resolved Error: commit -allow-empty-message --file=-

chairmanPC

Active member
Joined
Apr 19, 2021
Messages
38
Programming Experience
10+
I have created a C# Windows Form project back in April. Decided to create a repo in Azure DevOps so I can work on my project elsewhere.

I made some improvements to the program and I was able to commit the changes to my Azure DevOps repo without errors. But just now, I had some more last minute changes that I had to make, so I reopened the solution again and went right to work.

However, when I finished and when I was going to commit the changes, I got greeted with this error:

Error: commit -allow-empty-message --file=-.

As you can see in the image below. See that I've entered some text to commit the changes, but the VS still complained that I didn't type anything.
1626159094866.png



And the output from General and Source Control never gave any errors.
1626159064706.png

1626159124764.png


How do I fix this?
 

Attachments

  • FastStoneEditor1.png
    FastStoneEditor1.png
    15.8 KB · Views: 147
Solution
I've resolved it.

Pain in the rear, but I had to unbind my DevOps library with my project by deleting the gitignore, gitattributes files and git folder from the project folder. After that, I relink my project to my repo, and all went well.
I don't know whether this is the case or not but it might be that that rule requires a minimum length of comment and not just that it's not totally empty. That would be a measure to stop people using meaningless comments like "commit" that are effectively empty. Here's an idea: how about you actually describe the changes you made in the comment? That's why the comment is there. If you ever want to roll back to a specific state, having "commit" a hundred times in your history will be particularly unhelpful.
 
I don't know whether this is the case or not but it might be that that rule requires a minimum length of comment and not just that it's not totally empty. That would be a measure to stop people using meaningless comments like "commit" that are effectively empty. Here's an idea: how about you actually describe the changes you made in the comment? That's why the comment is there. If you ever want to roll back to a specific state, having "commit" a hundred times in your history will be particularly unhelpful.
Actually no. I had to fix one or two minor bugs that I caught in the program, that's all When I wrote the changes in the message box, it still spat the error at me. This "commit" message is just a "place holder".
 
I see. In that case, it seems like there's something wrong with VS somewhere that is preventing that message being pushed to the repo. Personally, I've only ever seen that message when I have indeed failed to provide a comment. If it were me, I'd try a repair on VS.

You did mention that you are working on two different machines. Is it possible to test a superficial change on the other machine to make sure that that still works? If it does then it's definitely a problem with VS on the other machine but if it doesn't then it might be an issue with the repo. In that case, I'm in the dark as far as how to fix it.
 
If all else fails, use the CMD, PowerShell, or Git bash window.
 
I've resolved it.

Pain in the rear, but I had to unbind my DevOps library with my project by deleting the gitignore, gitattributes files and git folder from the project folder. After that, I relink my project to my repo, and all went well.
 
Solution
Back
Top Bottom