git-find
A tool (cli & lib) to find local git repositories.
Why
Because I need a tool to list and to reorg my local git repositories.
Usage Cli
& )
)
}} }} }} }}
<DIR> root
- broadcast
git status
to every repositories
|
Template format
The template format is a subset of golang text/template.
Possibles values
!! Experimental: values could change with future release !!
- .path
- .file_name
- .full
- .remotes
- .<name_of_remote> : eg 'origin'
- .name
- .url_full
- .url_host
- .url_path
- .<name_of_remote> : eg 'origin'
Samples
- to list local repository
{{ .path.file_name }}\t{{ .path.full }}
- to list local repository with origin url
{{ .path.file_name }}\t{{ .path.full }}\t{{with .remotes.origin}} {{ .name }} {{.url_full}} {{.url_host}} {{.url_path}} {{end}}
- to create a sh script to "git fetch" on every repository
cd {{ .path.full }}; echo "\n\n---------------------------------------------\n$PWD"; git fetch
- to create a sh script to move git repository under $HOME/src (same layout as go workspace)
echo "\n\n---------------------------------------------\n"
PRJ_SRC={{ .path.full }}
{{with .remotes.origin}}
PRJ_DST=$HOME/src/{{ .url_host }}/{{ .url_path}}
if [ ! -d $PRJ_DST ] ; then
read -p "move $PRJ_SRC to $PRJ_DST ?" answer
case $answer in
[yY]* )
mkdir -p $(dirname $PRJ_DST)
mv $PRJ_SRC $PRJ_DST
;;
* ) ;;
esac
fi
{{end}}
Install
From cargo
With Rust's package manager cargo, you can install via:
Note that rust version 1.26.0 or later is required.
From binaries
!! Experimental !!
The release page includes precompiled binaries for Linux, macOS and Windows.
- download archives for your OS
- unarchive it, and move the executable into the PATH
From source
# Build
# Run unit tests and integration tests
# Install
Related and similar
Some tools to help management of multi repository But not the same features, else no need to re-do.
Informations
- peap/git-global: Keep track of all your git repositories. (I quickly look at the source to estimate my contribution to add features, but the "potentials" changes are too many and could change the goal usage of the tool)
- totten/git-scan: CLI tool for scanning/updating git repos
- fboender/multi-git-status: Show uncommitted, untracked and unpushed changes for multiple Git repos
Actions (broadcast)
- gr - A tool for managing multiple git repositories
- mu-repo, Tool to help working with multiple git repositories (short for Multiple Repositories).
- mr which is a tool to manage all your version control repositories.
- Repo command reference | Android Open Source Project
TODO
- find a rust template engine that support calling method (getter) on current field (or contribute to gtmpl as it's a feature of go template)
- internally use stream / queue instead of Vector
- build linux binary with musl (see https://github.com/emk/rust-musl-builder)
- optimize