-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Clean Commit History | ||
|
||
on: workflow_dispatch | ||
|
||
|
||
jobs: | ||
clean_history: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Remove commit history | ||
run: | | ||
# Set up Git user | ||
git config --global user.name "Wenjie Fu" | ||
git config --global user.email "[email protected]" | ||
git branch | ||
ls | ||
# Create a new orphan branch with the latest commit | ||
git checkout --orphan latest_commit | ||
# Add all files to the new branch | ||
git add -A | ||
# Commit the changes | ||
git commit -m "Final Commit" | ||
# Rename the current branch to main | ||
git branch -m latest_commit | ||
# Force push to update the repository | ||
git push -f origin latest_commit:main |