So, what I'm basically trying to do is pull the given commit (identified by its SHA) from one remote repo, and then drag it to another remote repo as a new branch (whose name I autogenerate). The original repo will change, and these are all one-time operations, so I don’t want git remote addthese remote objects, and I don’t want to create refs / branch for commits. And I do not want to change the HEADs of any of my local branches.
So, how can I just grab this 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 enables merging or rebase, so there can be no question.
I tried git fetch https://github.com/foo/bar.git 7d0969daba1fdf9d5bb9bc9a2847fd1bc1c7e426
but it just leads to
error: no such remote ref 12819ad8e10e5906df5352d7d8fec1fceb1f3afc
(and, yes, I checked that this SHA exists on this remote computer, it looks like git does not accept SHA here).
I mean, I think I could come up with one arbitrary name for the local branch to always pull commits down and then delete that branch after every click, but that seems inelegant ...
source
share