简体   繁体   中英

How can I remove merged commit logs?

在此处输入图像描述

Blue line is feature branch, red line is develop branch.
As you can see, develop branch was merged middle of feature branch.
And develop branch's logs were all included in feature branch.
like below

8191985 [feature] log5
62e338b [feature] log4
713d596 [feature] log3
ba94b24 Merge branch 'develop' into feature
bd751e9 [develop] log2
bec7f92 [develop] log1
7beb908 [feature] log2
5c1d36d [feature] log1

How can I clean up the develop branch's logs?
They didn't work well when I did like below..(conflict has occurred)

> git checkout feature
> git rebase develop

What thing I have to consider?

The question is what are you trying to achieve.

keep all the commits on feature branch, only rebase them on top of develop branch

In this case you did exactly right. You rebase feature branch on top of develop branch and you must resolve all conflicts.

Squash feature branch on top of develop branch

In this case you can avoid resolving conflicts by:

git checkout feature
git reset develop
git add .
git commit -m "All my feature changes squashed together"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM