This is how much of newbie git user I am, right here.
I’m working on a forked repo. I’ve created a new branch and am working on it,
making commits. I want to share the work on my fork so that I can work on
another computer, so I am pushing those commits with
git push origin <branch>.
I want to squash those commits eventually to a single commit that I can use for
If you do a basic
git rebase your local repo is in order, however you
have now diverged from
You can see here that
399 (my topic branch) is only one commit beyond
master which is what I wanted but
origin/399 now needs to be merged. There
is actually no need to do that because the content of the
are already in
155ec9b here, so we want to get rid of the useless branch.
My solution is to create a new branch on HEAD, push that to remote and then
delete both the local and remote branches of
399. Probably a better way to do
it but that’s where I’m at, frankly.
Deleting old remote branch after PR
I wasn’t sure what to do with an old branch used for a previous PR in my fork repo. I had already removed the local branch. This fixed it:
Yeah, you can just delete it. git removes dangling branches.
I originally got into a mess with my git branches by pushing a commit to remote
and then going back and doing a
git --amend, adding a new change I’d
forgotten to put into that that commit, leaving me with a divergencence from the
local branch and the remote. I didn’t want to merge commit and mess up the
history, so I ended up doing
git pull and going down the
git rebase route.
I know. I’ll get better.
I love git for it’s arcane complexity.