The sequence of commands you gave would be close, but it will not create a single commit for the rebase + local changes. To start, you might as well fetch, and the diagrams below will assume you've kept your remote refs in sync with the remote repo. So if there's anything you haven't fetched, go ahead and fetch it. Then:
It sounds like you had
A --- B --- C <--(develop)(origin/develop)
\
X1 --- X2 --- X3 <--(branch_x)
Next you rebased from branch_x
to develop (...so hopefully there was no remote branch_x
?), and someone else pushed changes to develop:
A --- B --- C --- D <--(origin/develop)
\
X1' --- X2' --- X3' <--(develop)
And you made some more changes from your local develop
.
(Your proposed command list starts with add
and commit
so I gather those aren't even locally staged yet...):
A --- B --- C --- D <--(origin/develop)
\
X1' --- X2' --- X3' <--(develop)
\
o <--WORKING TREE
So you want to combine X1'
, X2'
, X3'
, and o
into a single commit whose parent is D
, right?
Well, to start go ahead and commit your local changes.
git add --update
git commit
(Not sure why you're using --update
, but as long as you don't mean to add new files, it's fine.)
A --- B --- C --- D <--(origin/develop)
\
X1' --- X2' --- X3' --- Y <--(develop)
Now you say you can't do a squash
, but it's unclear to me why that would be. It seems to me from here the easiest thing to do is
git checkout origin/develop
git merge --squash develop
# handle conflicts
git commit -m "rebase + my changes"
git branch -f develop
which gives you
A --- B --- C --- D <--(origin/develop)
\
X1X2X3Y <--(develop)
And now you can push.