I have a git workflow scenario question and have provided the "current" and "desired" branch structures, but I don't know the correct commands to get to the desired state.
Current:
a -- b --> Branch1 (there are no commits after b)
\
\
c -- d -- e --> Branch2
I want to rebase or reset head (not merge, as I want a straight line history in log) such that Branch 1 looks like this:
Desired:
a -- b -- c -- d -- e --> Branch1
\
\
c -- d -- e --> Branch2 (this branch may be removed)
I realise that the head of Branch2 must now be the head of Branch1, but don't know if the following commands will ensure changes c and d will also become part of Branch1 or if the new commit history will look like a -- b -- e:
git checkout Branch1
git reset Branch2
Thank you for your time!
git branch -F branch1 branch2so thatbranch1moves to the same commit thatbranch2is pointing to. If you want to removebranch2you might instead deletebranch1and renam branch2 to branch1:got branch -m branch2 branch1. It's the same end result as moving the pointer and then deletingbranch2.headorHEAD.HEADhas a very special meaning in git: it's whatever commit/branch you are working on, and it's not necessarily pointing to a branch.