0

I know what to do when I get that "! [rejected] develop -> develop (non-fast-forward)" error message after a git push origin develop (git pull --rebase works for me), so that's not what I'm asking, but when I'm in a hurry sometimes I can miss that error message and the change I meant to push sits on my local machine until someone asks why my new feature doesn't seem to be working.

So, is there a way to configure git (or bash) so that I can highlight the error (or even pop-up a message box) whenever it occurs?

For example, this demonstrates what I might want to see:

# Instead of "git push origin develop" simulate the error
echo "! [rejected] develop -> develop" | \
    ack --passthru --color-match=bright_red "\[rejected]"

I would want to keep using just git push origin develop as I'm quite likely to forget to use git-push-with-highlight origin develop or whatever.

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
  • If the answers in [How to colorify git errors, warnings and fatal messages?](https://stackoverflow.com/q/14414696/5291015) help, then this is more likely a dupe – Inian May 15 '19 at 05:17
  • @Inian, yup, that seems to cover everything - except my Ubuntu `git` is too old. – Ken Y-N May 15 '19 at 05:20

0 Answers0