Git:如何处理不同的shebang [英] Git: how to deal with different shebang

查看:157
本文介绍了Git:如何处理不同的shebang的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人们如何处理本地和远程的不同shebang?例如,我的本地python是/ usr / bin / python,而我的web主机是在〜/ local / bin / python中专门构建的python。主开发人员可能在/ usr / bin / ruby​​中有ruby,而我的是/ usr / local / bin / ruby​​。我手动编辑shebang,然后git将其标记为改变。理想情况下,我希望git忽略文件的第一行,或者忽略文件中行的正则表达式匹配。



在我看来,这必须是这是一个非常普遍的问题,但我找不到任何提及。



我使用git,但我不会在任何延伸中称自己为专家。

解决方案

更改为

 #! usr / bin / env python 

 #!/ usr / bin / env ruby​​ 

然后它应该可以在所有系统上运行,只要你在 PATH 环境变量中有python和ruby。


How do people deal with different shebangs between local and remote?

For example, my local python is /usr/bin/python, whereas my web host is a purpose-built python at ~/local/bin/python. A lead developer may have ruby at /usr/bin/ruby, whereas mine is /usr/local/bin/ruby.

I manually edit the shebang, but then git marks it as a change. Ideally, I would like git to ignore the first line of the file, or perhaps to ignore a regex match of lines within the file.

It seems to me this must be a very common problem, but I cannot find any mention of it.

I use git, but I would not call myself an expert by any stretch.

解决方案

Change it to

#!/usr/bin/env python

or

#!/usr/bin/env ruby

Then it should work on all your systems, provided you have python and ruby in your PATH environment variable.

这篇关于Git:如何处理不同的shebang的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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