https://github.com/ggonnella/git-batch-op
allows to run git repository operations on a group of repositories
https://github.com/ggonnella/git-batch-op
Last synced: 3 months ago
JSON representation
allows to run git repository operations on a group of repositories
- Host: GitHub
- URL: https://github.com/ggonnella/git-batch-op
- Owner: ggonnella
- Created: 2022-04-06T22:56:15.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-23T10:27:18.000Z (about 3 years ago)
- Last Synced: 2025-01-16T16:23:21.851Z (4 months ago)
- Language: Shell
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
GitBatchOp project is a Bash script which allows to run git repository
operations on a group of repositories.# Installation
To install GitBatchOp, the repository main directory must be in path so that
the ``g`` script is found.
Auto-completion can be enabled in Bash by sourcing the provided
auto-completion script ``g-completion.bash``, e.g. in the Bash startup files.# Configuration file
The location of all git repositories, as well as the repository groups
configurations are stored in a configuration file
(default location: ``$HOME/.config/ggscripts/git_repository_locations``).
Empty and comment lines in this file are ignored.Each repository belong to a group; depending on the group
different operations are allowed and performed by the scripts.
Lines starting with ! are group and groupsets tab-separated declaration lines.In the group declaration lines, the fields are:
- [``!``, ``group``] constant values
- group ID (format: like a C identifier)
- ``allow_up``: allow this group as a target for the up operation (values: "yes" or "no")e.g.: ``! group gg yes``
In groupset declaration lines, the fields are:
- [``!``, ``groupset``] constant values
- groupsetID (format: like a C identifier)
- group [group ...]: space separated list of group names
to be included in the groupset
- ``allow_up``: allow this groupset as a target for the up operation (values: "yes" or "no")e.g.: ``! groupset all gg gg2 gg3 no``
Finally, the metadata of repositories, such as location in different systems is
stored. Each system is identified by the result of ``hostname`` or by the value
assigned to an env variable called ``$NETWORK``.The fields for each repository metadata line:
- : group ID to which to assign the repository
- server[,server2,...]: name of hosts for which a given location is given:
- : path to the repository
- : a short repo-ID; optional, but if not provided, then single-repo
operations will not be availablee.g.: ``gg hostA,hostB,hostC ~/notes notes``
# git up macro
The ``up`` macro, defined in ``git-up-macro`` can be added to the ``$HOME/.gitconfig``
git configuration file.It defines an action ``git up``, which adds all modifications,
commits with the message "update" and pushes upstream.
If used as ``git up foo bar`` it uses the rest of the line as commit
message.
It should not be used in repositories where commit messages matter.
Thus the configuration file of git-batch-op (see below) allows to
specify that the ``up`` operation (when called using ``g``) is allowed
on specific group (and sets of groups) of repositories.# Command line interface
In the following ```` is either a repository ID or a group ID
as defined in the configuration file.- ``g st [ ...]``: show the current status of all target repos
- ``g df [ ...]``: show git diff with the HEAD for all target repos
- ``g lg [ ...]``: show last commit log of all target repos
- ``g ls [ ...]``: show the path to all target repos
- ``g up commit msg``: commit and push changes in repo withID ;
using the specified commit msg
- ``g up ``: commit and push changes in repo withID ;
use "updated" as git commit msg
- ``$(g cd ): go to the path of repository with ID
- ``g --conf``: open the configuration file in vim