7

I've been following the successful Git branching model guide for most of my development. I still wonder if the way I handle bug tickets is correct.

My current workflow: Once I accept a bug ticket I will do a git checkout -b bug/{ticket_number}, create a single commit as a fix and then checkout develop and do a git merge --no-ff.

I'd love to hear from the experiences of others whether or not I am abusing the --no-ff option in this instance. If I am, could someone suggest a better approach?

asked Jun 7, 2012 at 14:54
5
  • 2
    This seems like a great approach. Commented Jun 7, 2012 at 20:02
  • The only thing to add is that if your project has several release branches then you should check out the bug/hotfix branch out of that (i.e. fixing bugs on a previous release). Commented Jun 8, 2012 at 16:42
  • 1
    This answer to another question about fast-forward merges is excellent and may help you decide if your outlined workflow is the best way to represent your bugfixes in the Git history: stackoverflow.com/a/2850413/81234 Commented Jun 8, 2012 at 16:47
  • Why do you think the use of that option counts as abuse? Commented Jun 8, 2012 at 20:01
  • @MarkCanlas I have a lot of single commit bug fixes and so I'm doubling the amount of commits in history to include the merge commits. I wasn't sure if I was spamming the history with merge commits. Commented Jun 10, 2012 at 22:21

1 Answer 1

4

You don't need to do all your work as a single commit; you can commit multiple times and squash the commits when you merge back into the original branch (which is the default merge behavior). If the bug is significant, that might be helpful.

Also, if the branch is open for a long time, you might want to rebase the branch (basically, recreate the branch from a newest root version and apply your changes again); this will update the branch with the upstream changes and you'll be able to verify if any change upstream has broken your bugfix.

After you have pushed your branch upstream, however (in case you do that), rebasing is not recommended. You can create a new branch from the root and merge your old branch into the new. This seems to work, but I'm not sure if it's correct.

sleske
10.3k3 gold badges32 silver badges46 bronze badges
answered Jun 8, 2012 at 19:38
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.