Follow these steps to delete single or multiple files from your Git repository and prune it from history. You should also add the file(s) to .gitignore (Step 5) to avoid committing the same files to your repo again in the future.
- git clone <repo-path>
- git rm file1 file2
- git filter-repo --force --invert-paths --path file1
- git filter-repo --force --invert-paths --path file2
- nano .gitignore
- git add .
- git commit -m "deleted file1 file2"
- git remote add origin <repo-path>
- git remote -v
- git push origin --force --all
- git push origin --force --tags
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.