I recently got the task to add a certain feature to a project I'm working on. As this feature depends on old code that was cruel to use, I decided to split the task in 2 steps:
- refactor old code to be more usable
- create feature using refactored code
I created a branch feat/foo, and after the refactoring was done, I merged it into our master so we could use the changes directly. Now I'm left with the following commit history:
A ---> B ---> C --> E ---> F <master B: created branch feat/foo
| ^ D: refactoring finished
D -----------| C: changes in master in between
^ E: merge commit
feat/foo F: master is now here
feat/foo still points to D, and my master advanced to be at commit F. What would I do now to continue my work on this task in branch feat/foo? I see two possibilities:
- either delete feat/foo and
checkout -b
it again, so I have a new branch that has the same name as my old branch, - or somehow "reuse" feat/foo, which I don't know how to do
The first solution somehow feels not quite right to me, it seems "wrong" to delete the branch just to create it again. But I don't know how I could reuse it.
What should I do? Delete and recreate the branch, or if the right answer would be reusing it, how?