I have a repo in which there are branches main (local and remote), develop (local and remote) and feature1 (only local)
Between the main and develop there are some commits, but nothing complicated only some commits ahead.
Obviously I can forward merge main with develop but I don't wish to do that
On the other hand, I want to merge some of the first commits separating develop from main into main.
I have always merged between branches, but can I merge also based on the commit ID?
Or should I go to the commit I want to merge, create a temporal branch there and forward main to that branch?
(Answering to that part specifically)
You can indeed merge commits, which is what git ultimately does behind the scenes when you merge a branch.
Let's say you have
You can, from your
mainbranch,git merge D(by its commit hash directly, but you could also point to it by creating a temp branch, a tag, using a relative ref, anything goes) and it would then fast-forward yourmainbranch toAnd of course, at this point you might either want to merge
F(which would implicitly mergeEandF) or justEfor the moment if needed.