Skip to content

vibewitharyaan/git-history-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Git History Cleaner

I created this tool for my personal use to easily reset a Git repository’s history without touching the actual code. If you find it helpful, you’re welcome to use or modify it as you like — no restrictions.

What it is

A simple script (available for both Windows and Linux) that:

  • Clones your Git repo into a temporary folder
  • Deletes all commit history
  • Keeps your current files
  • Pushes a fresh commit to the same branch

How to use it

  1. Make sure Git is installed and set up.
  2. Run the script:
    • On Windows, use ghc_windows.bat
    • On Linux/Mac, use ghc_linux.sh
  3. Enter your repo URL when asked.
  4. Confirm the cleanup.
  5. That’s it — the repo will be cleaned and updated.

⚠️ Always back up important work before running the script.

Features

  • Works on both Windows and Linux
  • Checks if Git is set up
  • Keeps your latest code intact
  • Asks for confirmation before deleting history
  • Auto-cleans temporary folders after use

Limitations

  • Commit history is permanently deleted — no undo
  • Doesn’t support submodules or complex Git configs
  • Basic error handling only

About

Clean Git repo history and keep only the latest files. Works on Windows and Linux.

Topics

Resources

Stars

Watchers

Forks