gitme is a handy Bash function that lets you quickly jump to any of your
Git repositories by name or remote URL. It's perfect if you have dozens (or
hundreds) of repos spread across different directories.
You give gitme a search string. It looks through all your Git repositories
in the directories you specify and, if it finds a match:
- If there's only one match, it changes to that directory.
- If there are multiple matches, it asks you to choose one.
- If there's no match, it tells you so.
Clone this repo and add the following to your shell config (~/.bashrc,
~/.zshrc, etc):
source /path/to/gitme/gitme.shIf you have bash-completion
installed, then gitme can make use of that to make things even easier. Just
add the following to your shell config file:
[[ -f /path/to/gitme/gitme-completion.bash ]] && source /path/to/gitme/gitme-completion.bash
💡 Replace
/path/to/gitme/with the actual path to this repo on your machine.
Then reload your shell:
source ~/.bashrc # or ~/.zshrcgitme searches directories listed in the GITME_DIRS environment variable.
This should be a colon-separated list, like:
export GITME_DIRS="$HOME/code:$HOME/projects:$HOME/scratch"If GITME_DIRS is not set, it defaults to:
$HOME/gitYou can also customize the cache directory by setting GITME_CACHE_DIR:
export GITME_CACHE_DIR="$HOME/.gitme" # defaultgitme search-stringExamples:
gitme utils
gitme github.com/davorg
gitme my-projectgitme uses a cache to avoid scanning directories on every invocation, making
searches much faster. The cache is stored at ~/.gitme/cache by default.
- The cache is automatically built on first use
- To rebuild the cache (e.g., after cloning new repos), run:
gitme --rebuild-cacheYou can read the man page directly with:
man ./man/gitme.1Or install it system-wide:
sudo cp man/gitme.1.gz /usr/local/share/man/man1/
sudo mandbAlternatively, install it for just your user account:
mkdir -p ~/.local/share/man/man1
cp man/gitme.1.gz ~/.local/share/man/man1/
# (Optional) Add to your shell config:
# export MANPATH="$HOME/.local/share/man:$MANPATH"- Matches both the directory name and the remote.origin.url
- Works across multiple base directories
- Fast caching for quick lookups
- Bash tab-completion for easy discovery
- Interactive selection if more than one match
- Written as a function so it can actually
cdinto the repo
Here are a few possible enhancements (pull requests welcome!):
- Optional
fzf-powered fuzzy search - Case-insensitive matching
- Support for multiple remotes, not just
origin gitme clonehelper for quick cloning into the right place
Dave Cross
📍 davorg
This project is MIT licensed. Use it, share it, improve it.