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

implement hook logic to rename branch in bugfix and feature (fix #352) #353

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

sdementen
Copy link

added two hooks pre-flow-bugfix-prepare-name-branch and pre-flow-feature-prepare-name-branch that allows branch renaming before creation (call during git flow bugfix/feature start)
use case: create a branch by giving an issue ID (github, jira, pivotal, ...) and let the hook adapt the branch name to include the issue description (as the ID is not user friendly). The logic to retrieve the issue description from the ID and adapting the name of the branch can be implemented in the 2 new hooks

@jkankiewicz
Copy link

jkankiewicz commented Mar 15, 2018

What if the issue's description is edited later?
The only identifying aspect of an issue that's immutable is its ID so that's all that should be used to relate its corresponding bugfix/feature branch to it.

@sdementen
Copy link
Author

Having just the ID in the branch name make it very difficult (for me at least) to quickly understand the purpose of the feature branch (without each time making a lookup to find the subject).
I use the title and not the description and even if the title change it is better than just the ID (again, for me, maybe others can map easily by just looking at 8 digit ID)

@jkankiewicz
Copy link

At most this hook should validate that the feature/bugfix name can be mapped to an issue unambiguously; preventing a non-conforming branch from being created is not as bad as mutating the branch name that the user specified, especially if they are surprised by it.

IMHO the logic for converting an issue ID into its title belongs in the tool that you're viewing the repository with and not the tool that's creating the branches. That way you'll see the issue's current title and it can be rendered as a hyperlink that, when clicked, displays the entire issue in a browser.

@sdementen
Copy link
Author

I am using pyxharm as IDE and use it's git integration. I do not see how the IDE can do this integration (showing the title + hyperlink) neither when I am using git from the console. Any pointers to such plugins for pyxharm and the console ?

And why would the user be surprised ? He/she should first install himself the hook, shouldn't be/she? To be clear, I do not want the hook itself to be included in gitflow, just the ability to call the hook at the right moment in gitflow.

When using GitHub, having the possibility to start a feature or bugfix with just the issue ID and getting a meaningful name for the branch is something I have often dreamt about !

@ChrisJStone
Copy link

I'm in the process of updating gitflow. If you could kindly resubmit your pull request against my fork here as it appears this fork is no longer being updated.

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

Successfully merging this pull request may close these issues.

4 participants