AlexStarc / git-iterate

An utility to iterate over subdirectories containing a Git repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

git-iterate

If you have to repeat a same Git operation over a bunch of subdirectories (e.g. 'status' or 'branch -vv'), this small Git addon is dedicated to this task.

Examples:

git iterate -- status
git iterate -q dir1 dir2 -- fetch --all
git iterate -q dir1 dir2 foreach myscript.sh

Syntax

General syntax:

git iterate [-q|--quiet] [<dir>...] -- <command>
  • -q: [optional] Remove all non-error output
  • --quiet: [optional] Remove the directory names in which Git is currently running
  • ...: [optional] Subdirectories names where the Git subcommand must be run, by default current directory
  • : standard Git command and parameters ('status', 'fetch --all', 'pull', etc.)

Non-Git commands:

git iterate [-q|--quiet] [<dir>...] foreach <shellcommand>
  • -q: [optional] Remove all non-error output
  • --quiet: [optional] Remove the directory names in which Git is currently running
  • ...: [optional] Subdirectories names where the Git subcommand must be run, by default current directory
  • : general shell command to be executed in Git directories ('ls', etc.)

License

  • License: WTFPL 2.0
  • Author: Seb35 - Sébastien Beyou

Contribute

Although this is a small program, any contribution is welcome! Please open an issue to discuss ideas or bugs, or even submit pull requests to propose implementations.

Here are some ideas for possible improvements.

Quality:

  • test in various environments - I only tested it on Debian
  • still improve documentation?
  • write unit tests
  • package - for DEB, RPM, …
  • translate the documentation
  • get some user feedback about the CLI interface, and amongst others: the quiet options

Bugs:

  • detect if bold is supported and possibly how: 1. if no bold is supported it should be deactivated, for instance in non-console outputs or non-compatible consoles; 2. I saw "echo -e" must be used for Bash but "echo" must be used for sh.

Features:

  • add an option to use non-bold for the directory names?
  • add a special syntax git iterate [<dir>...] to only display Git directories?
  • add an option to stop on first error, on first output? use a non-zero exit code in this case?
  • add an option to explicitely search Git directories inside Git directories? or make it the default behaviour (will be longer in this case)?

About

An utility to iterate over subdirectories containing a Git repository

License:Do What The F*ck You Want To Public License


Languages

Language:Roff 53.6%Language:Shell 46.4%