mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 07:26:17 -04:00
[ feat ] Use default global ignore file
This commit is contained in:
parent
54f8205478
commit
8ed7da3f02
|
|
@ -11,19 +11,23 @@ function show_contents {
|
|||
fi
|
||||
}
|
||||
|
||||
function global_ignore() {
|
||||
git config --global core.excludesfile || echo $XDG_CONFIG_HOME/git/ignore || echo $HOME/.config/git/ignore
|
||||
}
|
||||
|
||||
function show_global {
|
||||
show_contents Global `git config --global core.excludesfile`
|
||||
show_contents Global "$(global_ignore)"
|
||||
}
|
||||
|
||||
function add_global {
|
||||
local global_gitignore=$(git config --global core.excludesfile)
|
||||
local global_gitignore="$(global_ignore)"
|
||||
if [ -z "$global_gitignore" ]; then
|
||||
echo "Can't find global .gitignore."
|
||||
echo ""
|
||||
echo "Use 'git config --global --add core.excludesfile ~/.gitignore-global' to set the path to your global gitignore file to '~/.gitignore-global'."
|
||||
echo ""
|
||||
else
|
||||
add_patterns `git config --global core.excludesfile` "$@"
|
||||
add_patterns "$global_gitignore" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue