So I forked a project, and made a few changes and pushed those to origin/master. I didn’t intend to send these changes back to upstream. All was fine and good until now, but now I have some changes I do want to push upstream.
Can I rebase back to upstream in a different branch, and commit to that branch? Can I commit these changes from my branch? Have I horribly mangled my repo?
No, no mangling. Just branch from upstream/master, make your commits there, and then you can push (or pull-request) those commits, which fit neatly onto upstream/master.
If you have A—B—C, where upstream/master is at A and master is at C, meaning B and C are commits you don’t want to send upstream, then:
If you have commits you’re not going to send back on master, it might be simpler to keep track of things if you move those into a different branch and keep your master in sync with upstream/master:
will effectively replace “master” with “my-stuff-not-sent-upstream” and set master and origin/master back to the same commit as upstream/master.