【问题标题】:TortoiseGit - pre-rebase hook not executedTortoiseGit - 未执行预变基挂钩
【发布时间】:2014-03-21 21:51:29
【问题描述】:

我在 Windows 7 下工作,我已经安装了 msysgit 和 TortoiseGit。 我为 git 存储库编写了一个 pre-rebase 挂钩。

当我从 Git Bash 重新构建 repo 时会调用该钩子。 但是,如果我从 TortoiseGit 启动变基,则不会调用钩子。 我尝试编写一个预提交钩子,它适用于 bot Git Bash 和 TortoiseGit。

钩子如下:

#!/bin/sh
#
# Copyright (c) 2006, 2008 Junio C Hamano
#
# The "pre-rebase" hook is run just before "git rebase" starts doing
# its job, and can prevent the command from running by exiting with
# non-zero status.
#
# The hook is called with the following parameters:
#
# $1 -- the upstream the series was forked from.
# $2 -- the branch being rebased (or empty when rebasing the current branch).
#
# This sample shows how to prevent topic branches that are already
# merged to 'next' branch from getting rebased, because allowing it
# would result in rebasing already published history.

echo '************************************************************'
echo '********************** Running CMake  **********************'
echo '************************************************************'
cmake -G "Visual Studio 11" -BBuild/ -Hsrc

怎么了?

【问题讨论】:

    标签: git githooks tortoisegit


    【解决方案1】:

    据我所知(使用git reflog),TortoiseGit 中的“rebase”并没有真正执行真正的git rebase。相反,TortoiseGit 使用cherry-picks 模拟变基。

    我不知道为什么,也许是为了启用交互式 rebase 的 gui?

    无论如何,由于没有执行真正的变基,因此不会运行与变基相关的钩子。

    【讨论】:

    • “真正的” git 也使用cherry-picks ;)
    • @MrTux 在什么意义上? Cherry picks 和 rebases 在git reflog 中看起来不同,并触发不同的钩子。
    • Rebase 只是一个围绕着樱桃挑选的 bash 脚本。
    猜你喜欢
    • 2021-09-10
    • 1970-01-01
    • 2015-08-31
    • 2014-05-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-05-28
    相关资源
    最近更新 更多