https://github.com/petems/git-merged-master
https://github.com/petems/git-merged-master
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/petems/git-merged-master
- Owner: petems
- License: mit
- Created: 2020-01-28T14:56:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-05T00:21:12.000Z (over 5 years ago)
- Last Synced: 2025-01-12T16:37:47.630Z (6 months ago)
- Language: Go
- Homepage:
- Size: 1.74 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-merged-master
[](https://travis-ci.org/petems/git-merged-master)
A helper function that uses the `src-d/go-git.v4` library is a determine what branches have already been merged into master in a remote
It iterates through the commits in master, and the head branch of all existing remote branches, and if the head branch of the remote branches matches the commit in master then it is marked as a merged branch:
```golang
err = masterCommits.ForEach(func(commit *object.Commit) error {
for branchName, branchHead := range remoteBranchHeads {
if branchHead.String() == commit.Hash.String() {
log.Infof("Branch %s head (%s) was found in master, so has been merged!\n", branchName, branchHead)
mergedBranches = append(mergedBranches, branchName)
}
}
return nil
})
```## Usage
WIP