相关疑难解决方法(0)

使用git rebase,有没有办法使用默认命令在git-rebase-todo中重写提交消息?

假设我跑了 git rebase -i HEAD~3

pick 6b24464 foo
pick a681432 Foo
pick 8ccba08 foo foo

# Rebase 960c384..8ccba08 onto 960c384
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the …
Run Code Online (Sandbox Code Playgroud)

git git-rebase

17
推荐指数
3
解决办法
5257
查看次数

git commit --amend是如何工作的?

在独立的HEAD状态下看过GIT commit --amend.这个问题要求答案比需要的要复杂得多.我想了解git commit --amend在正常HEAD情况下​​的工作原理.

git git-amend git-commit

11
推荐指数
2
解决办法
3357
查看次数

以编程方式使用 git rebase -i

我编写了一个节点模块,它使用 git 时不时地进行一堆提交。考虑到如果将提交分组为一个提交会更好,我想使用“git rebase -i”将它们压缩为一个提交。

然而,压缩只能在交互模式下进行,这意味着我需要手动编辑调用“git rebase -i”时弹出的编辑器中的行。我想知道是否可以以编程方式完成此过程?因此,例如,当用户调用“保存”函数时,我的模块会进行一堆提交,然后自动将它们压缩在一起。

更新

为了更准确地说明我正在做的事情,当调用“保存”函数时,它会传递一堆要“发布”的提交。然后,我的模块将挑选这些提交并将它们放入“发布”分支中。这是一个单一的“发布”操作,但它会在“发布”分支上生成一堆提交。我想做的是压缩发布时的提交,所以当我执行“git log”时,我看到的只是“发布版本 1”、“发布版本 2”等,而不是每个发布操作 5 或 10 个提交。

git rebase

5
推荐指数
1
解决办法
1079
查看次数

标签 统计

git ×3

git-amend ×1

git-commit ×1

git-rebase ×1

rebase ×1