From e50532d608452f0a250bc985f9c94d041b2460a0 Mon Sep 17 00:00:00 2001 From: Sthope Date: Sun, 30 Jul 2023 19:50:36 +0200 Subject: [PATCH] Add custom-cmds-in-ubuntu/bin_examples/git_remove_commits_history --- .../bin_examples/git_remove_commits_history | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 custom-cmds-in-ubuntu/bin_examples/git_remove_commits_history 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