Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding prompt to delete branch after merging #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions mnf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.

PROTECTED_BRANCHES=("dev" "test" "prod")

if [ $# -ne 1 ];
then
Expand All @@ -48,6 +49,23 @@ then
then
echo ""
echo "-------- Merge completed successfully! --------"

PROTECTED_BRANCH=false
for branch in "${PROTECTED_BRANCHES[@]}"; do
if [ "$1" == "$branch" ]; then
PROTECTED_BRANCH=true
break
fi
done

if [ "$PROTECTED_BRANCH" == false ];
then
read -p "Do you want to delete the feature branch? (Y/n): " DELETE_BRANCH
if [ "$DELETE_BRANCH" == "Y" ] || [ "$DELETE_BRANCH" == "y" ];
then
git branch -d $1
fi
fi
else
echo ""
echo "-------- Merge completed successfully, but there was a problem when popping the stash. Please resolve the conflicts manually and run 'git stash drop', or reset your working directory and run 'git stash pop' on another branch. --------"
Expand Down