#!/bin/bash
# Check if branch name is provided
if [ -z "$1" ]; then
echo "Please provide a branch name to merge into the current branch."
exit 1
fi
# Fetch the latest changes
git fetch origin
# Checkout the current branch and merge
git checkout "$1"
git pull origin "$1"
# Merge the specified branch into the current branch
git checkout -
git merge "$1"
# Push the changes to the remote repository
git push
echo "Merged branch '$1' into the current branch and pushed changes."
Save this script as merge-branch.sh
and run it with: