Last active
January 4, 2016 11:39
-
-
Save ckunte/8483a89f583b6c3f15b9 to your computer and use it in GitHub Desktop.
This script allows me to purge my git history. (Run from within the root of repo's folder.)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
ph.py -- purge (git) history | |
2015 ckunte | |
""" | |
import os | |
def main(): | |
fullpath = os.getcwd() | |
foldername = os.path.basename(os.path.normpath(fullpath)) | |
repo = "[email protected]:ckunte/" + foldername + ".git" | |
cmd1 = 'git reset --hard; rm -rf .git/; git init; git add .; git commit -m "first commit.";' | |
cmd2 = 'git remote add origin ' + repo + '; git push --force origin master;' | |
os.system(cmd1 + cmd2) | |
pass | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment