Skip to content

Clear Git History and Keep Current Files #6

Clear Git History and Keep Current Files

Clear Git History and Keep Current Files #6

Workflow file for this run

name: Remove File History
# Manual trigger via workflow_dispatch
on:
workflow_dispatch:
jobs:
remove-file-history:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0 # Ensure full history is fetched
- name: Install git-filter-repo
run: |
sudo apt-get install python3-pip
pip3 install git-filter-repo
- name: Remove file history
run: |
git filter-repo --path .github/wokflows/update-lists.yml --invert-paths
- name: Re-add remote origin
run: |
git remote add origin https://github.com/${{ github.repository }}.git
- name: Force push rewritten history
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git push origin --force --all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}