Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Add a "--base" option to the "git flow {bugfix,feature} rebase" command #407

Open
jkankiewicz opened this issue Mar 13, 2019 · 0 comments
Open

Comments

@jkankiewicz
Copy link

jkankiewicz commented Mar 13, 2019

Please add a --base <base> command line option to the git flow {bugfix,feature} rebase command so that an orphaned bugfix/feature branch can be conveniently rebased on develop—or another bugfix/feature branch—while also updating its corresponding section in the .git/config file to record its new base branch.

Ideally every bugfix/feature branch should be based upon the develop branch but the git flow {bugfix,feature} start <name> command does support an optional <base> argument for when it shouldn't.
I use that optional argument to start a new bugfix/feature branch that is based upon a prior bugfix/feature branch whose changes are still under review so that I'm not blocked on that branch being finished.
Of course, when that prior bugfix/feature branch is finished I then need to rebase its orphaned child bugfix/feature branch on the develop branch but the git flow {bugfix,feature} rebase command doesn't provide a way to do it because its implicit <base_branch> argument can only be read from the .git/config file, it cannot be specified explicitly on the command line.
For example,

$ git flow feature start parent
Switched to a new branch 'feature/parent'

Summary of actions:
- A new branch 'feature/parent' was created, based on 'develop'
- You are now on branch 'feature/parent'

Now, start committing on your feature. When done, use:

     git flow feature finish parent

$ git flow feature start child feature/parent
Switched to a new branch 'feature/child'

Summary of actions:
- A new branch 'feature/child' was created, based on 'feature/parent'
- You are now on branch 'feature/child'

Now, start committing on your feature. When done, use:

     git flow feature finish child

$ git flow feature finish parent
Will try to rebase 'parent' which is based on 'develop'...
Successfully rebased and updated refs/heads/feature/parent.
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
Already up-to-date.
Deleted branch feature/parent (was ecb52f56).
$ cat .git/config
...
[gitflow "branch.feature/child"]
	base = feature/parent
...
$ git flow feature finish child
Fatal: The base 'feature/parent' doesn't exists locally or is not a branch. Can't finish the feature branch 'feature/child'.

While I could rebase an orphaned bugfix/feature branch using the git rebase command directly, doing so will not update the bugfix/feature branch's corresponding section in the .git/config file; it will continue to reference the non-existent bugfix/feature branch that it was originally based upon when it was started so I'd have to also edit the bugfix/feature branch's corresponding section in the .git/config file manually which places its referential integrity at further risk of human error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant