Working while waiting for pending PR
I'm assuming you want to start the new user_story_2
branch on top of the work you've done in user_story_1
. Here's the workflow I use in this sort of scenario:
Open Pull Request for
user_story_1
:* (user_story_1) * / * (master) * *
Create new branch
user_story_2
based onuser_story_1
:$ git checkout -b user_story_2 user_story_1
* (user_story_1, user_story_2) * / * (master) * *
Work on the new branch:
* (user_story_2) * * (user_story_1) * / * (master) * *
Pull Request gets merged:
* (user_story_2) * * | (master) |\| | * (user_story_1) | * |/ * * *
Delete old branch:
* (user_story_2) * * | (master) |\| | * | * |/ * * *
Rebase new branch onto
master
:* (user_story_2) * / * (master) |\ | * | * |/ * * *
My preferred workflow for this:
- On branch master,
git checkout -b user_story_1
. - Make changes to
user_story_1
. - Open PR for
user_story_1
. - On branch
user_story_1
,git checkout -b user_story_2
. - Make changes to
user_story_2
. - Once
user_story_1
gets merged into master, switch touser_story_2
and dogit rebase -i master
. - This should show you a list of commits on
user_story_2
that you want to include in the rebase. Delete the top few commits that came fromuser_story_1
. - The rebase should complete cleanly unless master was updated with other changes. Now you have
user_story_2
rebased on master and only having its commits.