This is not how it works.
The problem is that commit, semantically , is a set of changes , not a state.
Therefore, to send the last state, you need to send the change set from the initial ( x3 , not inclusive) to the final ( y3 ).
And since you want to present this set with one commit, you will have to make one commit that contains the changes in y1 .. y3 . With rebase -i you did it.
If you don’t want to lose the original commits, you can make squash in a separate branch (just before starting the rebuy, make git checkout -b local-develop-squashed while in the local-develop branch).
After rebuy get this state:
x1->x2->x3-\ {master} | |->y1->y2->y3 {local-develop} | \->z1 {local-develop-squashed}
In the local-develop-squashed compared to master , one beautiful commit is issued.
From this thread and need to do a pull request.
This, of course, has problems. If you want to complete this pull request, you will have to push --force each time, which is generally very dangerous . Therefore, you can download the original history from the heap of commits, and only when they give you a go, make a heap of commits into one right on the spot and do push --force .
And some of them use the --no-ff option when using the PR --no-ff , and the history is viewed with the help of git log --first-parent master , as a result of which the detailed history of the feature branches is not shown, and the PR looks like separate commits. And for this you do not need any shamanism with rewriting commits and push "by force".