Skip to content

Instantly share code, notes, and snippets.

@mohanarpit
Created May 29, 2013 10:41
Show Gist options
  • Save mohanarpit/5669427 to your computer and use it in GitHub Desktop.
Save mohanarpit/5669427 to your computer and use it in GitHub Desktop.
This script takes the SHA1-ID of the commit as the input and truncates the history of the repository for all commits beyond that SHA1-ID
#!/bin/bash
# This script takes the SHA-I1D of the commit as the input and truncates the history of the repository for all commits beyond # that SHA1-ID
git checkout --orphan tmp $1
git commit -m "Truncated history"
git rebase --onto tmp $1 master
git branch -D tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment