0

I have a question about git's work flow. I've found some guides, but maybe you guys can clarify this for me.

Alright so the normal workflow that we are using in our department/project is:

  1. Master branch for big releases
  2. Dev branch for constant updating, which is merged to master for those big releases every month or so
  3. Features branches for all the issues we are tackling, that are pushed/merged to the dev branch once each feature is done and rebased into 1 commit.

So where I am having trouble is understanding on how to work on a branch that is dependant on another branch. To clarify:

file A has information for issues 1 and 2. Say I work on issue 1, and push that branch to be merged with dev. How do I work on issue 2, then once dev accepts the pull request from issue 1, update the code for issue 2 and then push to dev as a seperate issue.

I know that is a bit confusing so please let me know if I need to clarify.

I'm not sure if this is similar to what I am talking about :How to handle dependencies when using git topic branch workflow?

Community
  • 1
  • 1
vpoola88
  • 3,669
  • 4
  • 20
  • 21
  • 1
    [This answer](http://stackoverflow.com/a/6150034/2109908) in the question that you linked to *may* he helpful to you –  May 26 '13 at 02:29
  • So I wanted to clarify, I dont necessarily want to merge topic x with topic y, since they are seperate issues. There are just some files where they will overlap – vpoola88 May 26 '13 at 02:36
  • And say i go back and make changes to topic-x, and then it gets merged to dev. Would I re git-cherry-pick? or after it was merged is there a method to pull from dev into that branch? – vpoola88 May 26 '13 at 02:36
  • You could just merge topic-x and topic-y into your dev branch. –  May 26 '13 at 02:38
  • So @davblayn I first would work on topic-x, push to and make a request for it to be merged with dev. So the files are not yet in dev. then I would cherry-pick topic-x to topic-y so that code is brought over. I could then just send a request to merge into dev, but what happens if my team makes changes to topic-x first on the files that relate? How will topic-y get those changes? Would I have to wait for those changes to be commmitted, pull from that branch, re cherry-pick to topic-y and then push again? – vpoola88 May 26 '13 at 02:40
  • 1
    You would merge the dev branch into `topic-y`, this will add the changes that you merged into `dev` into `topic-y`. –  May 26 '13 at 02:43
  • Right, but what if topic-x hasnt yet been merged? I wish tehre was a way to draw this out – vpoola88 May 26 '13 at 02:44
  • You could then merge the changes that have been made in `topix-x` into `topic-y` –  May 26 '13 at 02:45
  • Do you mind if I move this conversation into chat? –  May 26 '13 at 02:46
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/30638/discussion-between-vpoola88-and-davblayn) – vpoola88 May 26 '13 at 02:47

2 Answers2

1

In this example, let's say that you are working on HTML in one branch (feature/html), and the CSS in another branch (feature/css). Additionally, you mentioned that there is a dev branch and a master branch. Let's say that you push two commits to feature/html but you don't merge those changes up to dev.

If you want to work on the feature/css branch with the changes that you have committed into feature/html, you would simple merge the changes from feature/html into feature/css. You would do this with the following command:

$ git checkout feature/css # If you aren't already in the feature/css branch
$ git merge feature/html
1

Take a look at this. I find it really awesome.

Chris
  • 5,584
  • 9
  • 40
  • 58
QuestionEverything
  • 4,809
  • 7
  • 42
  • 61