Compare commits
No commits in common. "02922ccc55b58a72b97f4d6c1640850c8031c6f0" and "6e983f08e89766097b4f7b4507f4400f9e491ebc" have entirely different histories.
02922ccc55
...
6e983f08e8
17
README.md
17
README.md
@ -10,25 +10,14 @@ A CLI tool for making commits to many subrepos after a distributed change.
|
|||||||
|
|
||||||
- Automatically detects which subrepos have uncommitted changes
|
- Automatically detects which subrepos have uncommitted changes
|
||||||
- Creates commits with a single message across all modified subrepos
|
- Creates commits with a single message across all modified subrepos
|
||||||
- Push changes to remote repositories after committing
|
|
||||||
- View status of all modified repositories
|
|
||||||
- Reports commit status for each subrepo
|
- Reports commit status for each subrepo
|
||||||
- Written in Babashka for fast startup and easy distribution
|
- Written in Babashka for fast startup and easy distribution
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Show status of all modified subrepos
|
|
||||||
./commitly status
|
|
||||||
|
|
||||||
# Commit changes across all modified subrepos
|
# Commit changes across all modified subrepos
|
||||||
./commitly "Your commit message here"
|
./commitly "Your commit message here"
|
||||||
|
|
||||||
# Commit and push changes
|
|
||||||
./commitly -p "Your commit message here"
|
|
||||||
|
|
||||||
# Push only (without committing)
|
|
||||||
./commitly -p
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
@ -49,11 +38,7 @@ ln -s $(pwd)/commitly /usr/local/bin/commitly
|
|||||||
|
|
||||||
1. Scans parent directory for git repositories
|
1. Scans parent directory for git repositories
|
||||||
2. Checks each repository for uncommitted changes (staged or unstaged)
|
2. Checks each repository for uncommitted changes (staged or unstaged)
|
||||||
3. Depending on the command:
|
3. Commits changes in each modified repository with the provided message
|
||||||
- `status`: Shows git status for all modified repositories
|
|
||||||
- `<message>`: Commits changes in each modified repository with the provided message
|
|
||||||
- `-p <message>`: Commits and pushes changes to remote
|
|
||||||
- `-p` (no message): Pushes all repositories without committing
|
|
||||||
4. Reports success/failure for each repository
|
4. Reports success/failure for each repository
|
||||||
|
|
||||||
## Use Case
|
## Use Case
|
||||||
|
|||||||
15
commitly
15
commitly
@ -18,16 +18,11 @@
|
|||||||
(not (str/blank? (:out result)))))
|
(not (str/blank? (:out result)))))
|
||||||
|
|
||||||
(defn find-subrepos [parent-dir]
|
(defn find-subrepos [parent-dir]
|
||||||
"Find all git repositories in parent directory, including parent itself"
|
"Find all git repositories in parent directory"
|
||||||
(let [child-repos (->> (fs/list-dir parent-dir)
|
(->> (fs/list-dir parent-dir)
|
||||||
(filter fs/directory?)
|
(filter fs/directory?)
|
||||||
(filter git-repo?)
|
(filter git-repo?)
|
||||||
(map str))
|
(map str)))
|
||||||
parent-is-repo? (git-repo? parent-dir)
|
|
||||||
repos (if parent-is-repo?
|
|
||||||
(cons (str parent-dir) child-repos)
|
|
||||||
child-repos)]
|
|
||||||
repos))
|
|
||||||
|
|
||||||
(defn commit-changes [repo-path message]
|
(defn commit-changes [repo-path message]
|
||||||
"Commit all changes in repository with given message"
|
"Commit all changes in repository with given message"
|
||||||
|
|||||||
@ -9,22 +9,15 @@ Commitly is a Babashka script located at `commitly/commitly` that commits and pu
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./commitly/commitly status # Show status of modified repos
|
./commitly/commitly [-p] <commit-message>
|
||||||
./commitly/commitly [-p] <commit-message> # Commit (and push) changes
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
- `status` - Show git status for all modified repositories
|
|
||||||
- `-p` - Push changes after committing. If no commit message is provided with `-p`, it will skip committing and just push all subrepos.
|
- `-p` - Push changes after committing. If no commit message is provided with `-p`, it will skip committing and just push all subrepos.
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
**Show status of all modified repos:**
|
|
||||||
```bash
|
|
||||||
./commitly/commitly status
|
|
||||||
```
|
|
||||||
|
|
||||||
**Commit all modified repos with a message:**
|
**Commit all modified repos with a message:**
|
||||||
```bash
|
```bash
|
||||||
./commitly/commitly "fix: update configuration"
|
./commitly/commitly "fix: update configuration"
|
||||||
@ -44,11 +37,8 @@ Commitly is a Babashka script located at `commitly/commitly` that commits and pu
|
|||||||
|
|
||||||
1. **Discovery**: Scans the current directory for subdirectories containing `.git` folders
|
1. **Discovery**: Scans the current directory for subdirectories containing `.git` folders
|
||||||
2. **Detection**: Checks each repository for uncommitted changes using `git status --porcelain`
|
2. **Detection**: Checks each repository for uncommitted changes using `git status --porcelain`
|
||||||
3. **Action**: Depending on the command:
|
3. **Commit**: Runs `git add -A` and `git commit -m "<message>"` for each modified repo
|
||||||
- `status`: Shows full `git status` output for each modified repo
|
4. **Push**: If `-p` flag is present, runs `git push` for each successfully committed repo (or all repos if no message provided)
|
||||||
- `<message>`: Runs `git add -A` and `git commit -m "<message>"` for each modified repo
|
|
||||||
- `-p <message>`: Commits and then runs `git push` for each successfully committed repo
|
|
||||||
- `-p` (no message): Runs `git push` for all repos without committing
|
|
||||||
|
|
||||||
## When to Use
|
## When to Use
|
||||||
|
|
||||||
@ -61,7 +51,7 @@ The monorepo contains multiple independent git repositories:
|
|||||||
- `www/` - Dashboard website
|
- `www/` - Dashboard website
|
||||||
- `gateway/` - Nginx reverse proxy
|
- `gateway/` - Nginx reverse proxy
|
||||||
- `commitly/` - This tool itself
|
- `commitly/` - This tool itself
|
||||||
- Other service repositories as needed
|
- `just-vibes/` - Other projects
|
||||||
|
|
||||||
Each has its own `.git` directory and is deployed independently via Gitea Actions when pushed to main.
|
Each has its own `.git` directory and is deployed independently via Gitea Actions when pushed to main.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user