Remove mistakenly pushed files from GitHub
Unproofread notes
I accidentally pushed an incomplete blog post .md
file to GitHub for my personal blog, and then had to remove from GitHub without deleting it locally. So I looked it up, and this is how it's done:
- Remove the file from Git tracking (but keep it locally)
git rm --cached content/blog/still-brave-browser/index.md
- Commit the removal
git commit -m "Commit message"
- Push the changes to GitHub
git push origin main
Basically, the git rm --cached
command removes the file from Git's tracking without deleting it from your local filesystem, so you can continue editing it.
- ← Previous
Using Claude Code for non-coding tasks
Comment via email