Run command doesn't seem to be able to run `git`

27 views
Skip to first unread message

Oliver Weiler

unread,
Apr 13, 2022, 6:04:57 AMApr 13
to iterm2-discuss
Hi,

I would like to run the `git push` command whenever it is matched

    git push --set-upstream origin bar

I've created a trigger with a corresponding regexp:

Regexp:

\s+ git (push --set-upstream origin .+)

Run Command:
git \(matches[1|)

But nothing seems to happen :/.

Richard Mitchell

unread,
Apr 13, 2022, 6:25:10 AMApr 13
to iterm2-discuss
just curious, what event causes the text to match the trigger?

Oliver Weiler

unread,
Apr 13, 2022, 6:37:02 AMApr 13
to iterm2-discuss
Basically when I run `git push`, the following text is displayed.

$ git push
fatal: Der aktuelle Branch bar hat keinen Upstream-Branch.
Um den aktuellen Branch zu versenden und den Remote-Branch
als Upstream-Branch zu setzen, benutzen Sie


    git push --set-upstream origin bar
$

Richard Mitchell

unread,
Apr 13, 2022, 9:30:52 AMApr 13
to iterm2-discuss
Why not create an alias:

     alias gp='git push --set-uptsream origin bar'

Does require changing the command you're used to typing.

Another option is to create an alias in .gitconfig that replaces push with 'push --set-upsteam origin bar'

I've done that for log to create my own custom log output.
Reply all
Reply to author
Forward
0 new messages