如何知道是否有git rebase正在进行? [英] How to know if there is a git rebase in progress?

查看:260
本文介绍了如何知道是否有git rebase正在进行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我开始一个 git rebase -i 时,我可以发出像 git rebase --continue 这样的命令,或者 git rebase --abort 。这些命令仅适用于正在进行转版。



我怎样才能知道是否有转仓正在进行中?



(我会非常感谢一些关于rebase如何在内部工作的细节; git对回购有什么作用,使它处于正在发生变化状态,?)

解决方案

首先, 有a code> ORIG_HEAD 在重置期间(但不限于rebase命令)

但是你也可以看看2010年的Git 1.7.0 git-rebase.sh 脚本 本身(它可以像内部一样获得;))。
这些行可以给你另一个线索:

  dotest =$ GIT_DIR/ rebase-merge 
测试-d$ dotest-o -d$ GIT_DIR/ rebase-apply ||死亡没有发生重建?

sabgenton 评论


  • 文件夹 rebase-apply 似乎与 rebase

  • 但文件夹 rebase-merge 仅与 rebase -i 一起显示。


以及嬉皮评论,2017年, :


编码指南不鼓励使用 -o (参见 Documentation / CodingGuidelines ),所以正确的洼y 现在(2017年,也是自2011年以来,Git 1.7.6)是:




 (test -d.git / rebase-merge||测试-d.git / rebase-apply)||死亡没有发生重建? 

Jelaby 建议 $ b $ pre $ (test -d$(git rev-parse --git-路径rebase-merge)||
test -d$(git rev-parse --git-path rebase-apply))




这样可以正确处理没有 .git 目录,并且还允许您从工作目录的子目录运行此测试。

这是因为 git rev-parse --git-path< path> :确定 $ GIT_DIR /< path>






Git 2.6+(2015年第3季度)将在转化期间打印更多信息: $ b commit 592e412 commit 84e6fb9 (2015年7月6日),提交84e6fb9 (2015年7月6日)和 commit df25e94 commit 05eb563 (2015年6月30日)作者: GuillaumePagès( gitster

(由 Junio C Hamano - gitster - 提交178d2c7 ,2015年8月3日)


status :在 rebase -i



git状态期间提供更多信息 rebase -i 中给出了关于rebase期间完成的命令列表的更多信息。

它显示:


  • 执行最后两条命令并执行
  • 接下来的两行。



它还提供了在 .git 目录中查找整个文件的提示。



When I start a git rebase -i, I can issue commands like git rebase --continue, or git rebase --abort. Those commands only work if a rebase is in progress.

How can I know if there is a rebase in progress?

(I would greatly appreciate some details on how rebase works internally; what does git do to a repo that gives it the "rebase in progress" status,?)

解决方案

For one thing, there is a ORIG_HEAD in place during a rebase (but that is not limited to the rebase command)

But you can also look at the 2010 Git 1.7.0 git-rebase.sh script itself (which is as "internal" as you can get ;) ).
Lines like those can give you another clue:

dotest="$GIT_DIR"/rebase-merge
test -d "$dotest" -o -d "$GIT_DIR"/rebase-apply || die "No rebase in progress?"

sabgenton comments:

  • The folder rebase-apply seems to appear with rebase,
  • but a folder rebase-merge shows up only with with rebase -i.

And hippy also comments, in 2017, that:

The coding guidelines discourage the usage of -o (see Documentation/CodingGuidelines), so the correct way now (2017, but also since 2011, Git 1.7.6) is:

(test -d ".git/rebase-merge" || test -d ".git/rebase-apply") || die "No rebase in progress?"

Jelaby suggests in the comments:

(test -d "$(git rev-parse --git-path rebase-merge)" || \
 test -d "$(git rev-parse --git-path rebase-apply)" )

This correctly handles worktrees and unusual or non-standard layouts that don't have a .git directory, and also allows you to run this test from a subdir of the working directory.

That is because the git rev-parse --git-path <path>: does resolve "$GIT_DIR/<path>".


Git 2.6+ (Q3 2015) will print more information during a rebase:

See commit 592e412, commit 84e6fb9 (06 Jul 2015), commit 84e6fb9 (06 Jul 2015), and commit df25e94, commit 05eb563 (30 Jun 2015) by Guillaume Pagès (gitster).
(Merged by Junio C Hamano -- gitster -- in commit 178d2c7, 03 Aug 2015)

status: give more information during rebase -i

git status gives more information during rebase -i, about the list of commands that are done during the rebase.
It displays:

  • the last two commands executed and
  • the next two lines to be executed.

It also gives hints to find the whole files in .git directory.

这篇关于如何知道是否有git rebase正在进行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆