Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform a non-interactive git pull? [duplicate]

Tags:

git

I'm trying to write an automated build script, and one step pulls and merges the upstream master into the current branch. To do this, I'm running:

git pull origin master

However, if it finds any changes, it launches a terminal editor and prompts me to enter a merge comment. Why is a pull action trying to merge, and how do I disable this so it doesn't block the automated script?

If it can automatically merge, then it should complete with with no error code and no user prompts. Only if there's a conflict, should it return an error code.

like image 758
Cerin Avatar asked Mar 09 '17 15:03

Cerin


1 Answers

Probably you've configured your machine to execute a merge instead of a rebase while doing a pull.

Try this instead:

git pull --rebase origin master

It shall not request for your input if there's not a conflict.

Other option if you actually want the pull executed by merge instead of rebase is to resign to edit the commit message with something like this:

git pull --no-edit origin master
like image 151
Álvaro P. Avatar answered Oct 04 '22 21:10

Álvaro P.