As indicated by the commenter above, the fix is to use awk '{print $NF}'
instead of the cut
command.
git alias: Parameter doesn't work
-
05-08-2022 - |
Вопрос
I figured out that git branch | grep <something> | cut -d' ' -f2
will give me the name of a branch that contains the substring <something>
. I'm trying to put this command in a git alias, like so:
[alias]
gb = "!f(){ git branch | grep $1 | cut -d' ' -f2; };f"
# ...
However, this does not work; it just produces a blank line. How do I fix this?
Решение
Не связан с StackOverflow