4/15/2024

git tip, delete all history (commit) information

 



.

# Warning: This will destroy your current history.

# Ensure that you understand the consequences before running these commands.


# Go to your repository directory

cd path/to/your/repository


# Create a new initial commit

git checkout --orphan newBranch

git add -A

git commit -m "Initial commit"


# Delete the main branch

git branch -D main


# Rename the current branch to main

git branch -m main


# Force push to overwrite the history on the remote repository

git push --force origin main


..

No comments:

Post a Comment