Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see how much I have remaining of a rebase?

Tags:

git

git-rebase

How can I see how much work is left on a rebase while it's in progress?

I.e. I want to see how much work git has left to check.

like image 431
Kit Sunde Avatar asked Oct 08 '15 19:10

Kit Sunde


People also ask

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.

What happens if I rebase twice?

Rebasing a branch on another "re-applies" (fairly smartly, these days) the commits of the currently checked out branch on top of the tip of the target. So, yes, if you do it over and over again then you will keep your current branch up to date.


Video Answer


3 Answers

You are probably looking for this information for a normal rebase instead of an interactive rebase.

That information isn't shown for non interactive rebases. However you can find it out by looking in your rebase-apply directory.

In that directory there is all the information you need. Specifically if you are running with the default .git directory location you can find it out by running these commands

cat .git/rebase-apply/next
cat .git/rebase-apply/last

If you want to know the commit which is currently being applied then you can use the following

cat .git/rebase-apply/original-commit

And if you want to see the actual patches which are being applied then you can look at the numbered files in .git/rebase-apply

like image 69
Matt Vukomanovic Avatar answered Oct 31 '22 00:10

Matt Vukomanovic


Starting with git version 2.26

Here's the shell command that prints the rebase progress:

( RMD="$( git rev-parse --git-path 'rebase-merge/' )" && N=$( cat "${RMD}msgnum" ) && L=$( cat "${RMD}end" ) && echo "${N} / ${L}" ; )

Sample output will be like

4 / 7

You can modify the last echo command parameter to print it using the format you like.

For git with versions that are <= 2.25

( RaD="$( git rev-parse --git-path 'rebase-apply/' )" && N=$( cat "${RaD}next" ) && L=$( cat "${RaD}last" ) && echo "${N} / ${L}" ; )
like image 43
Victor Yarema Avatar answered Oct 31 '22 01:10

Victor Yarema


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.

like image 39
sschuberth Avatar answered Oct 31 '22 01:10

sschuberth