Git Merge Base Differ is a Kotlin library and CLI tool that detects files changed independently in both a local and remote Git branch since their common ancestor (merge base). It avoids fetching remote branches and uses only command-line Git and HTTP requests.
Given a local Git repository and two branches:
branchA
(exists both remotely and locally, but may have diverged)branchB
(created locally frombranchA
)
The tool finds files that were modified in both branches since their common base commit, based on:
- Local changes via Git CLI
- Remote changes via GitHub API
You can run the CLI using Gradle:
./gradlew run --args="--owner azimsh3r --repo testRepo --path C:\\Users\\Azim\\Desktop\\testRepoHeree --branchA master --branchB azim"
View available options:
./gradlew run --args="--help"
This library can be used directly in your Kotlin/Java project:
val differ = GitMergeBaseDiffer()
val changedFiles = differ.findCommonChangedFiles(
owner = "azimsh3r",
repo = "repo",
accessToken = "your-token",
localRepoPath = "path",
branchA = "master",
branchB = "azim"
)
The project includes unit tests for core functionality using JUnit 5 and MockK.
Run tests with:
./gradlew test
Contributions are welcome. Please keep the code clean, tested, and modular.