Let's say I have a master
branch and a project
branch, both on our remote origin
. Work is mainly being done in the project
branch, but occasionally a bug fix needs to go into master
so it can be deployed immediately. Eventually when the project is done, I want to be able to squash all the commits in project into a single commit and then merge that into master
.
Usually with feature branches (that are not pushed to origin
), we keep them up to date by merely rebasing with master
and going on our merry way, but because project
is its own branch on origin
, I'm not sure how to keep the history the way I want it (commits from master
, then new project
commits, with no merge commits ideally) due to the safeguards about rewriting history on remote branches. Currently we do it by deleting the remote project
and recreating it with the correct history, but this is definitely suboptimal.
I'm okay with rewriting history on remote project
because this is only a team of 2 and we understand the implications and are willing to be ridiculously careful. But how do I accomplish it?
git checkout project
git rebase master
git push origin +project:project
Now just to figure out how to correctly pull the changes on another computer!