This is related to trying to deal with unfinished user stories. An example:
In sprint 1, there is a user story #100. So we create a sprint branch (sprint-1) and then off that branch a user story branch (us-100). At the end of the sprint, the user story is not completed. The normal process is that user stories use pull requests to merge into the sprint branch and after the review, the sprint branch is merged into develop (using a pull request). Then the sprint branch is deleted. Since us-100 was not completed, it wasn't merged into sprint-1 and when sprint-1 is deleted, I'm not sure what is going on with us-100.
What I'd like to do is to "move" the us-100 branch to another sprint, e.g. to sprint-2 branch. Is this possible? How? Or is there a better way?
Just rebase your branch onto the new shared sprint branch.
For example:
git checkout us-100
git fetch
git rebase origin/sprint-2
git push -f origin us-100
Note that using -f
(--force
) is re-writing the history of the sprint-2
branch. IMO this is the correct thing to do, but if there are others who are also using that branch they will need to adjust since their version of sprint-2
will now be different.
They can do:
git checkout us-100
git fetch
git rebase origin/us-100
Now, the sprint-2
branch will be based off of your new sprint branch and you can proceed with it as usual.