Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 46 lines (41 sloc) 1.502 kB
# take a file/directory as arg1, to be added to ignore rules.
# the user selects which ignore rules using dmenu
# in the .gitconfig case, we should probably allow the user to edit it,
# because he probably wants a more generic pattern instead of the real
# basename
if [ -z "$file" -o ! -e "$file" ]
echo 'No such file or directory' >&2
exit 2
type=`echo \
".gitignore-root # files all developers of this repo will want to exclude, in one central location
.gitignore-dirname # same, but ignore file in parent directory, so you can have multiple .gitignore files
exclude # specific to it's repo, but irrelevant to other devs
.gitconfig # patterns you want to ignore, independent of the repository
" | dmenu | cut -d ' ' -f1`
[ -z "$type" ] && echo 'Cancelled' && exit 0
dirname=` dirname $file`
basename=`basename $file`
case $type in
root=`git root $file` || exit 2
dirname=$(readlink -f $dirname)
relative_dir=$(echo $dirname | sed "s#^$root##") # ie: /src
echo "$relative_dir/$basename" >> $root/.gitignore
git root $file >/dev/null || exit 2
echo "$basename" >> $dirname/.gitignore
root=`git root $file` || exit 2
dirname=$(readlink -f $dirname)
relative_dir=$(echo $dirname | sed "s#^$root##")
echo "$relative_dir/$basename" >> $root/info/exclude
#TODO. git config --get-all ?, then another dmenu? how many such config keys are allowed?
Jump to Line
Something went wrong with that request. Please try again.