Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
--baseoption toprcommandDescription
This pull request introduces a new
--baseoption to themalas prcommand, allowing users to specify a custom base branch for pull request generation. This enhances flexibility for projects using various branching strategies.Changes Made
malas prCommand Enhancement: Theprcommand now accepts an optional--base(or-b) argument.yargsconfiguration insrc/index.tshas been updated to include this new option.pullRequestFunction Modification:pullRequestfunction insrc/index.ts(and its compiled JavaScriptout/index.js) now accepts an optionalbaseArg.baseArgis provided, it overrides the automatically detected base branch and is used as the target for commit comparison.getCommitMessagesFunction Update:getCommitMessagesfunction insrc/git/gitUtils.ts(andout/git/gitUtils.js) has been updated to accept an optionaltargetBranchargument.targetBranchis used by thepullRequestfunction to fetch commit messages relative to the specified base branch.README.mdfile has been updated to include a new section titled "Using a Custom Base Branch," providing examples of how to use the--baseoption.--baseargument's applicability when using commits.Why These Changes Were Made
malas prdefaulted to comparing against the auto-detected base branch (usuallymain/master). This posed limitations for development workflows that involve intermediate branches (e.g., merging feature branches intodeveloporstagingbeforemain).malasmore adaptable to a wider range of Git branching strategies, improving its utility for different teams and projects.Impact of These Changes
malas pr --base <branch-name>, making the tool more powerful for complex branching scenarios.--baseargument is provided.README.mdprovides clear instructions and examples, ensuring users can quickly understand and leverage the new functionality.How to Test
main):feature-branch.malas prfeature-branchanddevelop(sincedevelopis ahead ofmain).--base develop(comparefeature-branchagainstdevelop):feature-branch.malas pr --base developfeature-branchrelative todevelop).--base main(comparefeature-branchagainstmain):feature-branch.malas pr --base mainmain).malas pr --base non-existent-branchmalasgracefully handles this, likely by showing a Git error message indicating the branch does not exist.