-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MergedCommits pre-rebase hook #182
Conversation
Returns a list of branches containing the commit that the given ref points to.
Commits that have already been merged into one of a specified set of destination branches should not be rebased.
Not sure that |
`git branch --contains #{commit_ref}`. | ||
split("\n"). | ||
reject { |s| s[/detached from/] }. # ignore detached HEAD | ||
map { |s| s[2..-1] } # trim leading 2 characters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, the output of git branch
can change based on the user's column.branch
config setting, so we need to specify the --column
flag explicitly to override whatever that is set to.
After playing around with a few of the options the best output I could find was:
git branch --contains <hash> --column=dense`
...which outputs:
master * current-branch some/other/branch another-branch
Since the asterisk marks the current branch and branches can't have spaces, we could split(/\s+/)
and filter out the asterisk to get all branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, wasn't aware of that option. Still need to snip out the (detached from <hash>)
entry before splitting on whitespace, though.
Thanks for addressing those comments. Merged in 7acea7f. |
Closes #179