Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
CursedPrograms authored Oct 20, 2024
1 parent 2b7db36 commit 3897ea6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions clear-commits.py
Original file line number Diff line number Diff line change
@@ -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"])

0 comments on commit 3897ea6

Please sign in to comment.