File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ function split_commits_to_branches() {
84
84
# Push the new branch to the remote repository
85
85
git push origin " $branch_name "
86
86
87
+ # Optionally delete the commit from the old branch
88
+ echo " Do you want to delete the commit from the original branch? (y/n)"
89
+ read -n 1 -r delete_commit < /dev/tty
90
+
91
+ if [[ " $delete_commit " == " y" || " $delete_commit " == " Y" ]]; then
92
+ git checkout " $original_branch "
93
+
94
+ # Remove the commit using a rebase
95
+ git rebase --autostash --onto " $commit_hash " ^ " $commit_hash "
96
+ git push origin " $original_branch " --force
97
+ fi
98
+
87
99
# Optionally, create a pull request using a CLI tool like GitHub CLI
88
100
# Uncomment the line below if you have GitHub CLI installed
89
101
# gh pr create --base main --head "$branch_name" --title "$commit_message"
You can’t perform that action at this time.
0 commit comments