Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell how far into a git rebase I am when resolving conflicts?

I am rebasing in git and am encountering many conflicts. I address each one and do git rebase --continue, only to be met with the next conflict. How can I see how close I am to successfully completing the rebase?

like image 527
Aaron Silverman Avatar asked Jul 18 '11 18:07

Aaron Silverman


People also ask

How do I check progress in rebase?

If you're using git-prompt.sh, your prompt will show something like |REBASE-i (x/y) when resolving a conflict during an interactive rebase, where x is rebase step out of y where the conflict occurred. Show activity on this post. If you just want to take a look at it and you're using Bash, you can run: __git_ps1 .

How long is rebase?

Since a recent Gitlab upgrade we have the problem that the rebase operation in merge requests takes around ten minutes in some developers' repositories while it works perfectly fast in others.


3 Answers

I'm not sure if you can get a measure of how far you have to go, but it lists how many commits into the rebase you are. In the error output is a line that looks like

Patch failed at 0003 <commit message>

0003 means you're three commits into the rebase.

like image 134
Ryan Stewart Avatar answered Oct 19 '22 01:10

Ryan Stewart


It looks like you can see a list of patches here:

.git/rebase-apply/[0-9]*
like image 38
Sean Johnston Avatar answered Oct 19 '22 03:10

Sean Johnston


If your question is about seeing how many conflicts are already resolved, I have I usually do a quick

$ git diff

while doing a rebase. Conflicting parts will not be staged yet (assuming you are using git mergetool).

Alternatively you could also directly grep for the conflict markers.

If you want to know how many commits were already applied, just use

$ git log REBASE_BASE..

where REBASE_BASE is the commit you are rebasing onto.

like image 24
Benjamin Bannier Avatar answered Oct 19 '22 01:10

Benjamin Bannier