Proper Github procedure

I am slowly working out Git using the Git front-end built into Eclipse.

I understand the standard procedure. For Bugfix 1 I did:

  1. I forked the main vassalengine master
  2. I created a branch based on the forked master
  3. Did a bunch of coding, committed it to my local branch and pushed it up to my fork at Github
  4. Create a Pull Request to merge my Github branch from my fork into the Vasselngine Master

Where I get confused is now I want to start work on Bugfix 2, but Bugfix 2 is dependent on code in Bugfix 1.

Do I:

  1. Create a new branch from master, and merge the bugfix 1 changes in? But then when I create a PR, all of the Bugfix 1 changes are also included in the PR, since they haven’t been applied to the vassal master yet. I only want Bugfix 2 changes in my PR.

or

  1. Create a new branch from the Bugfix 1 branch and apply the Bugfix 2 changes, then create a PR for Bugfix 2 compared to Bugfix 1. This appears to create a PR with just the Bugfix 2 changes, but the code can’t be merged into the Vassal master until Bugfix 1 has been merged. Is this useful?

or

  1. Wait unto Bugfix 1 has been finalised and merged to master so I can create a new clean branch that has bugfix 1 already applied?

Thanks,
Brent.

Good question, and there is no definite answer.

I will add option 4: depending on the degree of dependency of Bugfix 2 on Bugfix 1, decide on a case by case basis what is more appropriate out of options 1, 2 and 3. More likely out of 2 and 3, since option 1 would not result in a “clean” PR that only contains one bugfix.

Thus spake Brent Easton:

I am slowly working out Git using the Git front-end built into Eclipse.

I understand the standard procedure. For Bugfix 1 I did:

  1. I forked the main vassalengine master
  2. I created a branch based on the forked master
  3. Did a bunch of coding, committed it to my local branch and pushed it
    up to my fork at Github
  4. Create a Pull Request to merge my Github branch from my fork into the
    Vasselngine Master

That’s all fine.

Where I get confused is now I want to start work on Bugfix 2, but Bugfix
2 is dependent on code in Bugfix 1.

Here’s what I’d do:

Make a branch for Bugfix 1. Make a PR for it. Make a branch for Bugfix 2
off Bugfix 1’s branch. Make a PR for it. When we go to merge the PRs,
we’ll deal with Bugfix 1 first. If you look at the PR for Bugfix 2 after
Bugfix 1 is merged, you won’t see Bugfix 1’s commits in Bugfix 2’s PR
anymore, because they’ll already be in master.

The only thing needed to keep things straight is to put a note in the
Bugfix 2 PR that Bugfix 1 should be resolved first.


J.