git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Removing useless merge commit with "filter-branch"
@ 2012-03-08 23:21 Anatol Pomozov
  2012-03-08 23:30 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Anatol Pomozov @ 2012-03-08 23:21 UTC (permalink / raw)
  To: Git Mailing List

Hi,

I have a large project (~100K commits) and I need to split a part of
it into separate project. What I usually do in this case is

git filter-branch --prune-empty --index-filter 'git rm -rfq --cached
--ignore-unmatch UNNEEDED_DIRECTORIES' HEAD

that works more or less fine for me.

The original project has a lot of merge commits (don't ask me why).
Basically every non-merge commit is merged back to master branch
instead of rebasing on top of the master. In the command above I use
--prune-empty parameter that removes empty commits, but not their
merge points. This leaves a lot of "useless commit points" like this:

|
o      - merge commit that previously merged feature X
|\
| \
|  \
o  |   - real commit
|   |
|  /
|/
|


As of me such merge left-overs are completely useless and I would like
to remove them. Actually this task can be split into 2 steps:
1) Remove useless parents. A useless part is the one that points to a
commit that is *already* reachable by some other parent. This step
converts useless merge points to regular empty commits.
2) run filter branch with --prune-empty that removes such empty commits.


So my questions are:
1) What is the best way to remove "useless parents" as in the algorithm above?
2) Should such behavior (remove useless parent/merge commits) be
enabled when flag --prune-empty is used?

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-29 18:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-08 23:21 Removing useless merge commit with "filter-branch" Anatol Pomozov
2012-03-08 23:30 ` Junio C Hamano
2012-03-13 22:27   ` Anatol Pomozov
2012-03-29 18:26     ` Anatol Pomozov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).