如何直接嵌入bash脚本混帐别名内 [英] How to embed bash script directly inside a git alias

查看:136
本文介绍了如何直接嵌入bash脚本混帐别名内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以嵌入以下的bash shell code:

 在$名称(git的差异--name-仅$ 1);做的git difftool $ 1 $名称和放大器; DONE

直接进入创建一个Git别名:

 混帐配置--global alias.diffall ***我-bash- code-***在这里

这从我的<一上引线href=\"http://stackoverflow.com/questions/1220309/git-difftool-open-all-diff-files-immediately-not-in-serial/1291578#1291578\">$p$pvious问题/答案的话,在哪里我把code到sh文件,然后别名文件:

 混帐配置--global alias.diffall'!SH diffall.sh

但为简便起见,永无止境的追求,有一定有到C直接跳过该文件并插入$ C $到别名的方法吗?我想不通的格式...


解决方案

 混帐配置--global alias.diffall'!SH diffall.sh

这是在一种方式是多余的。如果你要添加diffall.sh'到$ PATH反正,为什么不将它保存为混帐diffall,并保存自己自定义别名。是的,混帐diffall将运行它。

Can I embed the following bash shell code:

for name in $(git diff --name-only $1); do git difftool $1 $name & done

directly into the creation of a git alias:

git config --global alias.diffall ***my-bash-code-here***

This leads on from my previous question/answer on SO, where I put the code into a .sh file and then aliased to the file:

git config --global alias.diffall '!sh diffall.sh'

But in the never-ending quest for simplicity, there's gotta be a way to skip the file and insert code directly into the alias? I can't figure out the format...

解决方案

git config --global alias.diffall '!sh diffall.sh'

This is redundant in one way. If you are going to add 'diffall.sh' into your $PATH anyway, why not save it as 'git-diffall', and save yourself from declaring an alias. Yes, "git diffall" will run it.

这篇关于如何直接嵌入bash脚本混帐别名内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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