From phpBB Development Wiki
You have something like this image:
Here is what you do.
Warning: you can lose your work when editing history. To be safe, copy your entire local phpBB repository somewhere as a backup.
1. First you need to fix your develop branch. You should not have made any changes on develop - if you do, create a feature branch from your changes.
Now, you reset develop to upstream develop as follows:
git checkout develop git reset --hard upstream/develop
2. Now you rebase your feature branch on top of fixed develop:
git checkout ticket/10708 git rebase -i develop
You will be given a list of commits. Normally you should only see commits for the feature branch you are rebasing (ticket/10708 in this case). If you see any other commits, and you did not make them, delete them.
You want to keep some of the other commits
If you see other commits and you did make them, these commits will be removed from the branch you are rebasing. If you want to keep them, you need to abort the rebase and then create a new branch and repeat the process.
1. While in the editor, either quit without making any changes or delete all lines not beginning with #.
2. You will now be on the same branch which has commits from two separate tickets. Let's say the other ticket is 10000.
3. Create a new branch for the other ticket:
git branch ticket/10000
4. Repeat the rebasing procedure for the current branch. This time delete any commits not belonging to the current branch.
5. Check out the other branch you created:
git checkout ticket/10000
6. Repeat the rebasing procedure. This time delete commits that are not relevant to ticket/10000.