如何查看我还剩多少变基?

问题描述 投票:0回答:6

如何查看 rebase 正在进行时还剩下多少工作?

即我想看看 git 还剩下多少工作需要检查。

git git-rebase
6个回答
26
投票

git
版本2.26开始

这是打印变基进度的 shell 命令:

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

示例输出如下

4 / 7

您可以修改最后一个

echo
命令参数以使用您喜欢的格式打印它。

对于
git
,版本为 <= 2.25

( RaD="$( git rev-parse --git-path 'rebase-apply/' )" && N=$( cat "${RaD}next" ) && L=$( cat "${RaD}last" ) && echo "${N} / ${L}" ; )

20
投票

您可能正在寻找此信息以进行正常的变基而不是交互式变基。

对于非交互式变基,不会显示该信息。不过,您可以通过查看您的 rebase-apply 目录来找到它。

该目录中有您需要的所有信息。 具体来说,如果您使用默认的 .git 目录位置运行,您可以通过运行这些命令来找到它

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

如果你想知道当前正在应用的提交,那么你可以使用以下内容

cat .git/rebase-apply/original-commit

如果您想查看正在应用的实际补丁,那么您可以查看 .git/rebase-apply 中的编号文件


3
投票

如果您使用 git-prompt.sh,在交互式变基期间解决冲突时,您的提示将显示类似

|REBASE-i (x/y)
的内容,其中
x
是发生冲突的
y
中的变基步骤。


0
投票

如果您只是想看一下并且正在使用 Bash,则可以运行:

__git_ps1
。它将显示类似于
(feature/avarias|MERGING)(base)
的内容,但涉及变基。该字符串旨在通过将其分配给变量
PS1
来组成提示。


0
投票

我想你正在寻找

git rebase --edit-todo

0
投票

git status

示例内容:

On branch xxx
Your branch and 'origin/xxx' have diverged,
and have 4 and 7 different commits each, respectively.
  (use "git pull" if you want to integrate the remote branch with yours)

No commands done.
Next commands to do (5 remaining commands):
   pick d33eb3d Add 3ds not performed case -
   edit c58cad6 Refactor extract method to update models
  (use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'xxx' on '18cc67c'.
  (use "git commit --amend" to amend the current commit)
  (use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working tree clean
© www.soinside.com 2019 - 2024. All rights reserved.