Repository: commitizen-tools/commitizen
Issue: Prevent Prerelease 'Bump' From Release Version With No Increment Detected

## Description
When there is already a release, shouldn't we be prevented from creating a prerelease version from the release version?  Found this to be odd as this goes against the proper flow of change denoted via semantic versioning (https://semver.org/#spec-item-3).  Perhaps this should only be allowed if `increment detected` is not `None`.

## Steps to reproduce
```sh
# Commits prior to bumps have been done, but are omitted here for the
# sake of displaying bump behavior
➜ cz bump -pr alpha
bump: version 0.1.0 → 0.1.1a0
tag to create: 0.1.1a0
increment detected: PATCH

Done!

# Tag '0.1.1' Created
➜ cz bump
bump: version 0.1.1a0 → 0.1.1
tag to create: 0.1.1
increment detected: None

Done!

# Release to prerelease 'bump' here
➜ cz bump -pr beta 
bump: version 0.1.1 → 0.1.1b0
tag to create: 0.1.1b0
increment detected: None

Done!

➜ cz bump -pr beta 
bump: version 0.1.1b0 → 0.1.1b1
tag to create: 0.1.1b1
increment detected: None

Done!

# Tag '0.1.1' Already Exists
➜ cz bump
bump: version 0.1.1b1 → 0.1.1
tag to create: 0.1.1
increment detected: None

fatal: tag '0.1.1' already exists
```

## Environment
<!--
cz version
python --version
python3 -c "import platform; print(platform.system())"
-->

- commitizen version: 2.4.1
- python version: Python 2.7.16, Python3 3.9.0
- operating system: MacOS Catalina, 10.15.6


Changed files:
tests/commands/test_bump_command.py, commitizen/commands/bump.py

diff --git a/commitizen/commands/bump.py b/commitizen/commands/bump.py
index f188c6ab..666e2953 100644
--- a/commitizen/commands/bump.py
+++ b/commitizen/commands/bump.py
@@ -112,6 +112,19 @@ class Bump:
         if increment is None:
             increment = self.find_increment(commits)
 
+        # It may happen that there are commits, but they are not elegible
+        # for an increment, this generates a problem when using prerelease (#281)
+        if (
+            prerelease
+            and increment is None
+            and not current_version_instance.is_prerelease
+        ):
+            raise NoCommitsFoundError(
+                "[NO_COMMITS_FOUND]\\n"
+                "No commits found to generate a pre-release.\\n"
+                "To avoid this error, manually specify the type of increment with `--increment`"
+            )
+
         # Increment is removed when current and next version
         # are expected to be prereleases.
         if prerelease and current_version_instance.is_prerelease:
@@ -123,6 +136,7 @@ class Bump:
             prerelease=prerelease,
             is_local_version=is_local_version,
         )
+
         new_tag_version = bump.create_tag(new_version, tag_format=tag_format)
         message = bump.create_commit_message(
             current_version, new_version, bump_commit_message
diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py
index 806c9305..77ea4840 100644
--- a/tests/commands/test_bump_command.py
+++ b/tests/commands/test_bump_command.py
@@ -358,3 +358,29 @@ def test_bump_with_changelog_config(mocker, changelog_path, config_path):
         out = f.read()
     assert out.startswith("#")
     assert "0.2.0" in out
+
+
+def test_prevent_prerelease_when_no_increment_detected(
+    mocker, capsys, tmp_commitizen_project
+):
+    create_file_and_commit("feat: new file")
+
+    testargs = ["cz", "bump", "--yes"]
+    mocker.patch.object(sys, "argv", testargs)
+
+    cli.main()
+    out, _ = capsys.readouterr()
+
+    assert "0.2.0" in out
+
+    create_file_and_commit("test: new file")
+    testargs = ["cz", "bump", "-pr", "beta"]
+    mocker.patch.object(sys, "argv", testargs)
+
+    with pytest.raises(NoCommitsFoundError) as excinfo:
+        cli.main()
+
+    expected_error_message = (
+        "[NO_COMMITS_FOUND]\\n" "No commits found to generate a pre-release."
+    )
+    assert expected_error_message in str(excinfo.value)