Skip to content

Instantly share code, notes, and snippets.

@visualmotive
Created December 11, 2013 19:15
Show Gist options
  • Save visualmotive/7916585 to your computer and use it in GitHub Desktop.
Save visualmotive/7916585 to your computer and use it in GitHub Desktop.
Using ctags nicely with git. Add the following files to ~/.git_template/hooks and ctags will always be up to date with your latest git merges/commits/rebases. This also puts the `tags` file into your repo's .git directory, so it won't clutter your workspace.
#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
trap "rm -f .git/tags.$$" EXIT
ctags --tag-relative -Rf.git/tags.$$ --exclude=.git --languages=-sql
mv .git/tags.$$ .git/tags
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
#!/bin/sh
.git/hooks/ctags >/dev/null 2>&1 &
#!/bin/sh
case "$1" in
rebase) exec .git/hooks/post-merge ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment