Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365000

Summary: Add a token for inserting the current git branch in the commit message
Product: [Technology] EGit Reporter: James Cuzella <TrinitronX>
Component: MylynAssignee: Project Inbox <egit.mylyn-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: b.muskalla, robin, TrinitronX
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=309578
Whiteboard:

Description James Cuzella CLA 2011-11-28 14:37:51 EST
Build Identifier: 20110916-0149

Here's a description of my use case:

I work on an agile team that uses Rally, and I am able to import user stories & sub-tasks into Eclipse with Mylyn.  This is great!  I use a single feature branch for each user story or defect.  Each sub-task usually cooresponds to one or more commits on this feature branch.  My team's workflow requires that I merge these into multiple SVN remote branches that coorespond to test, staging, and production environments.  I use git-svn locally so that I can use git locally.

However, with git-svn I am forced to rebase my feature branches a lot.  This sometimes causes some branch merging information to be lost... commits that I need to merge or cherry-pick to another remote SVN branch get lost in the noise of the log.

To solve this, I name each branch using the user story number (task.key), and name (task.description). For example:

Let's say I have User Story 123 named 'Fix some thing'.
task.key = US123
task.description = "Fix some thing"

I name my branch like so: "US123-fix-some-thing".  Ideally this would be handled automatically once the "feature branch" support in Bug 309578 is added.

To fix my merging & cherry-picking problems I have been adding the current branch I'm working on at commit time into each commit message.  This allows me to use this for easily finding all the commits that correspond to a user story.  I can then use 'git log --grep=US123' to find these.

It would be great to have the ability to add the current working git branch name to the commit message.  This would be something similar to the output of the __git_ps1 bash function that is commonly used to put the current working git branch into a user's PS1 bash prompt.  It appears that for simple branches, this is equivalent to the output of:  "git describe --contains --all HEAD"

The only caveat I can see for this in the future has to do with multiple git projects.  I currently don't use multiple git projects, and I'm not sure how EGit/Mylyn would handle this.  Presumably we would want some way of tying a Task/User Story/Defect to a feature branch on one or more projects?
How would the feature branches automatically created by Bug 309578 be tied to a project?  Maybe this information could be used?

Reproducible: Always
Comment 1 Robin Stocker CLA 2012-11-05 17:17:37 EST
The commit message field has content assist for files and previous messages. 

Would it be enough for your use case to also add a proposal which inserts the current branch name? That would be relatively easy to implement.