From 3897ea6e21382ddf07246e0193d99cafd2c1706a Mon Sep 17 00:00:00 2001 From: Cursed Entertainment <110344485+CursedPrograms@users.noreply.github.com> Date: Sun, 20 Oct 2024 13:59:09 +0200 Subject: [PATCH] Add files via upload --- clear-commits.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 clear-commits.py diff --git a/clear-commits.py b/clear-commits.py new file mode 100644 index 0000000..2654a11 --- /dev/null +++ b/clear-commits.py @@ -0,0 +1,28 @@ +import subprocess + +def run_command(command): + """Run a command in the shell and print the output.""" + try: + result = subprocess.run(command, check=True, text=True, capture_output=True) + print(result.stdout) + except subprocess.CalledProcessError as e: + print(f"Error: {e.stderr}") + exit(1) + +# Switch to a new orphan branch +run_command(["git", "checkout", "--orphan", "new_branch"]) + +# Stage all changes +run_command(["git", "add", "."]) + +# Commit changes +run_command(["git", "commit", "-m", "new_commit"]) + +# Delete the old main branch +run_command(["git", "branch", "-D", "main"]) + +# Rename the new branch to main +run_command(["git", "branch", "-m", "main"]) + +# Force push to the remote main branch +run_command(["git", "push", "-f", "origin", "main"]) \ No newline at end of file