hugemeow
hugemeow

Reputation: 7985

why git rebase -i based squash could lead to conflicts?

in fact there is only one person work on that repo, and there is only one branch on that repo, i use git rebase -i HEAD~200 to get rid of some meaningless commits which have "tirval commit" message in commit log, i think all these commit could be squash to previous commits, it is so natural that my current branch is not in conflict state, and all previous commits are without conflicts, even when there were conflicts, they were solved, why squash could lead to conflicts?

btw, is there quiet mode to do git rebase -i without confirming lots of popups?

Upvotes: 0

Views: 1294

Answers (1)

Matthieu Moy
Matthieu Moy

Reputation: 16587

git rebase -i do two things:

  • Rebase, i.e. rewrite your commits on top of an upstream branch.
  • Edit, i.e. do what you've asked for in the todo-list

Just a squash shouldn't introduce conflicts (except if you removed commits), but the rebase itself can introduce conflicts even if you didn't change the todo-list in the interactive part.

As @hugemeow notes in the comments, another case where conflicts can happen is if your initial history contains merges. See this question for more details: Why does git-rebase give me merge conflicts when all I'm doing is squashing commits?.

Upvotes: 1

Related Questions