在一个Git别名管道? [英] Pipes in a git Alias?

查看:354
本文介绍了在一个Git别名管道?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上有恼人的大牌特性分支工作,所以我最后往往grepping我目前的分行名称,当我需要从我的本地特性分支推到特性分支,像这样:

I work on feature branches that have annoying big names, so I often end up grepping my current branch name when I need to push up to the feature branch from my local feature branch, like so:

git branch | grep '*' | sed 's/* //' | xargs git push origin

这工作正常。我想使这个别名,所以我做了这个在〜/的.gitconfig:

This works fine. I want to make this an alias, so I did this in ~/.gitconfig:

[alias]
   pushcur = branch | grep '*' | sed 's/* //' | xargs git push origin

现在,当我运行混帐pushcur ,我收到以下错误:

Now, when I run git pushcur, I get the following error:

usage: git branch [options] [-r | -a] [--merged | --no-merged]

引领我相信,别名没有正确解析管道。有没有别的东西我应该做的,以达到预期的别名?

Leading me to believe that the alias is not properly parsing the pipes. Is there something else I should do to achieve the desired alias?

推荐答案

我不认为你可以,但你可以

I don't think you can, but you can

[alias]
    pushcur = ! git branch | grep '*' …

这篇关于在一个Git别名管道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆