I have two branches called develop
and feature
, they both have lots of commits. Is there a way that I can make a branch called diff
that it's based on develop
and has a single commit that makes contents of develop
looks exactly like feature
?
Basically diff
and feature
has the same content but it has a single commit that turns develop
looks like feature
.
- Before
feature - B - D - F - G
/
develop A - C - E
- After
feature - B - D - F - G
/
develop A - C - E - - -
\
diff H
G
and H
has same content so I can get rid of feature
completely
CodePudding user response:
git checkout -b diff feature
git reset --soft develop
git commit
or
git checkout -b diff develop
git read-tree -um feature
git commit
will do it.
Are you aware that what you're asking for will also revert the changes in E
?
CodePudding user response:
Maybe I am misunderstanding, but why don't you just do
git checkout develop
git pull origin feature
git checkout -b diff