So, what I'm basically trying to do is to pull down a given commit (identified by its SHA) from one remote repo, and then push it to another remote repo as a new branch (whose name I autogenerate). The source repo will vary and these are all one-shot operations, so I don't want to git remote add
these remotes and I don't want to create refs/branches for the commits. And I don't want to change the HEADs of any of my local branches.
So, how do I just grab the given remote commit (and any of its parent commits that are new to me) and add it/them to my local git database?
git pull
implicitly involves a merge or rebase, so that's out of the question.
I tried git fetch https://github.com/foo/bar.git 7d0969daba1fdf9d5bb9bc9a2847fd1bc1c7e426
but that just leads to
error: no such remote ref 12819ad8e10e5906df5352d7d8fec1fceb1f3afc
(and yes, I verified that that commit SHA exists on that remote; looks like git doesn't accept a SHA here anyway).
I mean, I guess I could come up with a single arbitrary local branch name to always pull the commits down into, and then delete that branch after every push, but that's seems inelegant...