Skip to contentSkip to conversation

Merging branches

DISCUSSION jhapk 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

jhapk

author
#0 lore raw

http://git.661346.n2.nabble.com/file/n5289861/git.jpg git.jpg

Hi,

I have a git history which looks something like as in the figure above. I want to merge Branch A in Branch B. However, the commits a1, a2 and a3 are ugly and so I don't want those commits in my Branch B log. Is there anyway that I can only pull the final form of Branch A without pulling the whole history of Branch A?

Thanks

Signature · 2 lines
View this message in context: http://git.661346.n2.nabble.com/Merging-branches-tp5289861p5289861.html
Sent from the git mailing list archive at Nabble.com.
#1 lore raw
Quoted 5 lines · jhapk

I have a git history which looks something like as in the figure above. I want to merge Branch A in Branch B. However, the commits a1, a2 and a3 are ugly and so I don't want those commits in my Branch B log. Is there anyway that I can only pull the final form of Branch A without pulling the whole history of Branch A?

Yes, you use rebase to squash or drop those commits, and then merge the branch.

#2 lore raw
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 5 lines · jhapk

I have a git history which looks something like as in the figure above. I want to merge Branch A in Branch B. However, the commits a1, a2 and a3 are ugly and so I don't want those commits in my Branch B log. Is there anyway that I can only pull the final form of Branch A without pulling the whole history of Branch A?

Yes, you use rebase to squash or drop those commits, and then merge the branch.

Or just "git merge --squash".

Have fun,

Avery