git:如何编辑`core.excludesFile`?

问题描述:

全局排除文件在core.excludesFile中配置。git:如何编辑`core.excludesFile`?

如何轻松编辑此文件?

这不像听起来那么简单。

如果已设置:

excludesFile = ~/.config/git/ignore 

然后你的manually expanding the ~ character的问题,这是不那么容易,因为你的希望。

以下别名会做的魔力为你:

edit-global-excludes = !"bash -c 'f=$(git config core.excludesFile); \"$EDITOR\" \"${f/#\\~/$HOME}\"' #" 

这相当于在shell提示下键入:

$ bash -c 'f=$(git config core.excludesFile); "$EDITOR" "${f/#\~/$HOME}"' #