Continue working on a Git branch after making a pull request
I've found myself in this situation a couple of times lately, and I'm not totally sure how best to handle it.
So I have a fork of a git repository that I'm contributing to. I keep my master branch synced with the upstream master branch.
When I want to work on a new feature, bugfix, etc, I create a branch from my master and do any work. When I'm done, I merge in any changes that have been made to upstream master in the meantime, and then send a pull request from my feature/bugfix branch to the upstream master.
Now, while I'm waiting for that pull request to be accepted, I want to work on something slightly different. However, the new feature work needs the bugfix/new feature that I just sent the pull request for. I need to build on it.
How do I branch/merge/handle branches in such a way that I can work on the continuation, while still being able to merge/pull request in my changes in a clean way once the first pull request is accepted into master?
This is all using Github, although I imagine the answer would be applicable to Git in general.
Solution 1:
Create a new branch feature2 based on the last commit to feature1. feature1 will not move forward any more, and can be merged.
feature2 can then be merged later (some people would argue to rebase feature2 on the commit where feature1 was merged into upstream, but personally i dislike rebasing).