From the comments, this appeared to be the solution. You had three branches:
- Master (M)
- Old feature branch (O)
- New feature branch (N)
N was branched off O accidentally, rather than M, which is what you intended. This means that there is a series of commits starting at a certain point in time in N and you want to recreate the branch with those commits as if you had branched from M.
The solution was to create a new branch:
- Newer feature branch (N2 from M)
Then identify a series of commit hashes from N, and apply them to N2. You can do that manually by cherry-picking each one in turn.
There was a risk that these would not apply cleanly, because M might have changed some files compared to O, and thus your work in N would have been based on outdated files/folders. Text change merging is a fairly simple algorithm, it does not understand code structure like humans can (in other words, not everything is mergeable).
However, as it turned out, the cherry-picks applied cleanly. If you had not been able to do that, you might have had to create a diff for each failing one, and see how to apply it manually to N2 given the changes in M. Where this happens, it is worth still trying to cherry-pick following commits, as they might not all need manual conflict resolution.