Show HN: Gita – a CLI tool to manage multiple Git repos
github.com
github.com
I've used multiple multiple repository tools and in the end all I happen to use is one (usually versioned) file to store a list of repositories and then a command which just loops over all repos and applies anything to it. If I need custom commands I use git aliases so that works both for normal git and whatever tool used.
But I do see the convenience in your proposal
→ cat ~/bin/git-all
#!/bin/bash
# Exit on error. Append "|| true" if you expect an error.
set -o errexit
# Exit on error inside any functions or subshells.
set -o errtrace
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
set -o nounset
# Catch the error in case command1 fails (but command2 succeeds) in `command1 |command2`
set -o pipefail
# Turn on traces, useful while debugging but commented out by default
# set -o xtrace
help() {
cat <<EOF
usage: git all <any-git-command>
Runs the git command for all repositories in the current directory.
Examples:
What just happened?
git all log -1 --oneline
What am I doing now?
git all status --short --branch
What is everything I'm working on?
git all branch -vv
EOF
}
banner() {
echo -e "\\033[1m=== $1 ===\\033[0m"
}
main() {
if (( $# < 1 )); then
help
exit 1
fi
folders=$(find . -maxdepth 2 -name .git -print0 | xargs -0 -n1 dirname)
for folder in $folders;
do
banner "$folder"
git -C "$folder" "$@" || true
done
}
main "$@"gita super <repo-name> <any command/alias>
For example:
gita super repo2 commit -am 'fix a bug'
mr register in the root of a git dir.
then `mr status` from home will show the state of all repo's registered, it's handy at the eod to see what repos you've touched but not committed.
I currently use a mix of mu-repo [1] and uncommitted [2]
For example, let's say that I have a release 1.0, which consists of a bunch of commit IDs of various repositories. How do I go back to that release without manually checking out the specific commit ID in each repo?
Very convenient. I have used it for ROS projects with multiples SCM
I haven't done that since using SVN 10 years ago.
`git {branch,diff,stash}` should be all you need for this.
Especially working with the stash will be a big productivity boost for you.
To be fair I don't even remember anymore when I've had to do anything extensive, it's been quite a while. I'm even able to handle merge conflicts right away from within my editor.
(I now consider myself pretty good with git as a result of being forced to learn gerrit, but I also still remember the early painful days)
(re: carrying all the history, I used to work somewhere where they checked the build artefacts in to svn on every release build. A naive "git svn" import was in the 10s of gigabytes.)
What else do you think is a fad? Linux? C?
Faddishness is in the process of adoption. Why is the vast majority of software using git? Is it really the most suitable for their use case? Is it really the most usable, given the notoriously poor orthogonality of the CLI? Or is the adoption driven by adoption of github and git as the new "default"?