We use a master/staging/feature branch strategy. master & staging are long lived, and feature branches only exist until merged with staging.
When merging staging into master, our jenkins server squashes the commits to create a single "release" commit in master that's tagged with the version.
Unfortunately, some changes are missed, i.e. files deleted in the feature branch are still present in master.
We want staging to have the entire commit history, and master to only have a single commit that's tagged with the release number.
I know that the issue is with squashing the commits & a lack of a shared history, my question is how to achieve a single commit on master with staging having the full history automatically (this has to happen on a jenkins server).
I have looked at rebase but I can't figure out if it can do what we want automatically (this has to happen on a jenkins server with no manual intervention).