diff --git a/custom-cmds-in-ubuntu/bin_examples/git_remove_commits_history b/custom-cmds-in-ubuntu/bin_examples/git_remove_commits_history new file mode 100644 index 0000000..666b1e4 --- /dev/null +++ b/custom-cmds-in-ubuntu/bin_examples/git_remove_commits_history @@ -0,0 +1,24 @@ +#!/bin/bash +# ___ _ _ _ __ +# / __|| |_ | |_ ___ | '_ \ ___ +# \__ \| _|| \ / _ \| .__// -_) +# |___/ \__||_||_|\___/|_| \___| + + +BRANCH_NAME="master" + +if [ -n "$1" ]; then + BRANCH_NAME=$1 +fi + +git checkout --orphan latest_branch + +git add -A + +git commit -am "Initial Commit" + +git branch -D $BRANCH_NAME + +git branch -m $BRANCH_NAME + +git push -f origin $BRANCH_NAME