忽略.gitignore中的符号链接 [英] Ignore symbolic links in .gitignore

查看:1070
本文介绍了忽略.gitignore中的符号链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以告诉Git忽略符号链接?我正在处理一个混合的Linux / Windows环境,正如你所知道的,符号链接在两者之间的处理方式是非常不同的。 解决方案

不,全球无法做到这一点。但是,如果您有很多符号链接,则可以使用bash脚本轻松将它们添加到您的repo的.gitignore文件中:

 <$ c $ f> $(git status --porcelain | grep'^ ??'| sed's / ^ ?? //');做
test -L$ f&& echo $ f>>的.gitignore; #添加符号链接
test -d$ f&& echo $ f \ *>>的.gitignore; #添加新目录以及
完成


Is it possible to tell Git to ignore symlinks ? I'm working with a mixed Linux / Windows environment and, as you know, symlinks are handled very differently between the two.

解决方案

No, it is not possible to do this globally. However, if you have lots of symlinks here is a bash script that you can use to easily add them to your repo's .gitignore file:

for f in $(git status --porcelain | grep '^??' | sed 's/^?? //'); do
    test -L "$f" && echo $f >> .gitignore; # add symlinks
    test -d "$f" && echo $f\* >> .gitignore; # add new directories as well
done

这篇关于忽略.gitignore中的符号链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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