1

My script looks like this:

branch_name=$1
declare -a instances=("w-instance.eu" "x-instance.eu" "y-instance.eu" "z-instance.org")

for instance in "${instances[@]}"
do
   cd "/home/ubuntu/$instance/mbf"
   git checkout "$branch_name"
   git pull origin "$branch_name"
   python manage.py collectstatic --noinput
   python manage.py migrate
   sudo apachectl restart
done

I run it like this:

bash pull_merge_restart.sh some_branch

When I set branch name in script explicitly git didn't prompted me about note for merge. Now it opens nano and displays:

Merge branch 'production' of github.com:andilabs/xyz into production

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

how to force git to use default message, so that script runs automatically without being interrupted for human interaction??

1 Answer 1

2

From git-pull:

--edit
-e
--no-edit

Invoke an editor before committing successful mechanical merge to further edit the auto-generated merge message, so that the user can explain and justify the merge. The --no-edit option can be used to accept the auto-generated message (this is generally discouraged).

Older scripts may depend on the historical behaviour of not allowing the user to edit the merge log message. They will see an editor opened when they run git merge. To make it easier to adjust such scripts to the updated behaviour, the environment variable GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.