Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Due to some reasons, I re-combined some previously splited Git repositories. (Using git-stitch-repo) Some commits are made across several sub-projects. And after re-combined, they are shown in duplicated entries.

I want to merge these duplicated commits in sequence, like uniq does.

share|improve this question
up vote 2 down vote accepted

If your commits are duplicate within the same branch, you can try a git rebase --interactive to trim/squash them (But it is not an automatic way to remove them, like some kind of uniq command)

The OP Xiè Jìléi asks:

Can I prepare an edit list by hand, and then send to rebase -i?

To which Max Nanasy replies:

GIT_EDITOR='cat "$EDIT_LIST" > ' git rebase -i "$REBASE_START"
share|improve this answer
Can I prepare an edit list by hand, and then send to rebase -i? – Xiè Jìléi Jan 8 '11 at 9:28
@谢继雷: I don't think so, but it could be the base for an interesting question of its own ;) – VonC Jan 8 '11 at 9:33
@XièJìléi GIT_EDITOR='cat "$EDIT_LIST" > ' g rebase -i "$REBASE_START" seems to work – Max Nanasy Nov 5 '12 at 6:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.