mirror of https://gitlab.com/gitlab-org/cli.git
feat(commands/mr/create): rebase if tracking branch already set
This commit is contained in:
parent
1ac2f628a6
commit
968cc868f7
|
@ -254,6 +254,16 @@ func createRun(opts *CreateOpts) error {
|
|||
}
|
||||
|
||||
if opts.Autofill {
|
||||
branchConfig := git.ReadBranchConfig(opts.SourceBranch)
|
||||
|
||||
// If there is branch information then rebase it before pushing
|
||||
if branchConfig.RemoteName != "" && (branchConfig.MergeRef != "" || branchConfig.RemoteURL != nil) {
|
||||
err := git.Rebase(opts.IO.StdOut, opts.IO.StdErr)
|
||||
if err != nil {
|
||||
return fmt.Errorf("rebase failed: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err = mrBodyAndTitle(opts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue