├── INSTALL ├── README.md ├── git-rekt └── install.sh /INSTALL: -------------------------------------------------------------------------------- 1 | #################################### 2 | ########## INSTALL ############# 3 | #################################### 4 | 5 | If you are a true rekker, you shouldn't need this, but 6 | I suppose I should explain how to git rekt. 7 | 8 | Simply run: 9 | sudo sh install.sh 10 | 11 | That's all there is to it! 12 | 13 | ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ 14 | 15 | In order to rek your repos, it's a simple command: 16 | git rekt 17 | 18 | Yeah that's right. Now you're rekkin'. Now you can live 19 | the life of the rekker. Go and GIT REKT! 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-rekt 2 | 3 | > Because sometimes repositories just need to git rekt 4 | 5 | ## What is git-rekt? 6 | 7 | Git-rekt is a plugin for git that will squash a project into a single commit. The current states of each branch will remain intact, but the history will be thoroughly rekt, which could be quite helpful for large repositories that take up a large amount of system memory. 8 | 9 | ## How do I install git-rekt? 10 | 11 | Git-rekt can be installed simply using the included install.sh script: 12 | 13 | sudo sh install.sh 14 | 15 | Installation instructions are also packaged with the plugin. 16 | 17 | ## How do I use git-rekt? 18 | 19 | Git-rekt can be used like any other git plugin, i.e. go to the repository that you wish to rek, and simply input 20 | 21 | git rekt 22 | 23 | This will give you the option of whether you are sure you want to rek the repository, and like any good program it will remove all history independent of your input. I suggest trying git rekt on the git-rekt source repository that you installed the plugin from. Compare the commit history before and after the use of git rekt and be astounded at how history vanishes in front of your eyes. 24 | -------------------------------------------------------------------------------- /git-rekt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ############################################ 4 | 5 | function rekt() 6 | { 7 | mkdir temp 8 | cd temp/ 9 | git init 10 | cd ../ 11 | cp -rf .git/config temp/.git/ 12 | if [ -f .gitignore ] 13 | then 14 | mv .gitignore ../.gitignore-temp 15 | fi 16 | 17 | for branch in $(git branch | cut -c3-) 18 | do 19 | cd temp/ 20 | git checkout --orphan "$branch" 21 | cd ../ 22 | git checkout "$branch" 23 | cp -r ./* temp/ 24 | cd temp/ 25 | git add ./* 26 | cd ../ 27 | done 28 | 29 | cd temp/ 30 | rm -rf temp/ #For some reason it nests temp directories... 31 | git commit -am "Git rekt" 32 | cd ../ 33 | 34 | for file in $(ls -a) 35 | do 36 | if [ "$file" != "temp" ] 37 | then 38 | echo "$file" 39 | rm -rf "$file" 40 | fi 41 | done 42 | 43 | mv -f temp/.git/ ./ 44 | if [ -f ../.gitignore-temp ] 45 | then 46 | mv ../.gitignore-temp ./.gitignore 47 | fi 48 | rm -rf temp 49 | git reset --hard HEAD 50 | } 51 | 52 | ############################################ 53 | ############################################ 54 | 55 | if [ ! -d .git/ ] 56 | then 57 | echo "No git repository present." 58 | echo "Exiting..." 59 | exit 60 | fi 61 | 62 | echo -n "Do you want to git rekt? [y/n]" 63 | read input 64 | 65 | if [ "$input" == "y" ] 66 | then 67 | echo "Consider yourself rekt." 68 | else 69 | echo "Sorry, it's too late now." 70 | fi 71 | 72 | rekt 73 | echo "Completed rekking" 74 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | if [ "$(id -u)" != "0" ]; then 2 | echo "This won't work if you aren't root" 3 | exit -1 4 | fi 5 | 6 | chmod a+x git-rekt 7 | cp git-rekt "$(git --exec-path)"/git-rekt 8 | --------------------------------------------------------------------------------