如何使用 git gui 进行 rebase?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4830344/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 09:57:57  来源:igfitidea点击:

How to do a rebase with git gui?

gitgit-rebasegit-gui

提问by Leif Gruenwoldt

I know how to do a git rebase from the command line, but how do you do it with the official git-gui?

我知道如何从命令行执行 git rebase,但是您如何使用官方git-gui 执行此操作

采纳答案by Ted Percival

Add this to the .gitconfigfile in your home directory to add rebase commands to the Tools menu:

将此添加到.gitconfig您的主目录中的文件中,以将 rebase 命令添加到“工具”菜单:

[guitool "Rebase onto..."]
    cmd = git rebase $REVISION
    revprompt = yes
[guitool "Rebase/Continue"]
    cmd = git rebase --continue
[guitool "Rebase/Skip"]
    cmd = git rebase --skip
[guitool "Rebase/Abort"]
    cmd = git rebase --abort
[guitool "Pull with Rebase"]
    cmd = git pull --rebase

回答by Leif Gruenwoldt

In git-gui:

git-gui

  1. Go to Tools -> Addand then enter a custom command i.e. git rebase master.
  2. Select Add globallyto have this option appear for all repositories. (It will write the configuration to your ~/.gitconfigfor you, as @Ted-Percival mentioned in his answer).
  1. 转到Tools -> Add然后输入自定义命令,即git rebase master.
  2. 选择全局添加以使所有存储库都显示此选项。(~/.gitconfig正如@Ted-Percival 在他的回答中提到的那样,它会为您写入配置)。

回答by Irfy

You can do a full interactive rebase with git gui, complete with commit selection, rewording and conflict resolution! In addition to Ted Percival's answer, Add this to your ~/.gitconfig:

您可以使用 进行完整的交互式变基git gui,包括提交选择、改写和冲突解决!除了 Ted Percival 的回答,请将其添加到您的~/.gitconfig

[guitool "Rebase interactive"]
    cmd = EDITOR=gvim git rebase -i $REVISION
    revprompt = yes

You mustuse a graphical editor -- plain old vimwon't work, but gvimwill. You may use any gui editor, I use neditfor example. A separate window of this editor will pop-up any time you need to input something: initially selecting commits, rewording commit messages (whether for reword or squash commits), etc.

必须使用图形编辑器——普通的旧版vim不能用,但gvim可以。您可以使用任何 gui 编辑器,nedit例如我使用的。每当您需要输入内容时,都会弹出此编辑器的一个单独窗口:最初选择提交、重新编写提交消息(无论是重新编写还是压缩提交)等。

回答by VonC

git guican be used to add files to the index when doing a rebase --interactive(as mention in thegit rebaseman page, The GitHub rebase help pageor in this git rebase interactive tip article), but not to perform the rebaseitself.
(unless, as you saw, you define the command yourself in the Tools section)

git gui可用于在执行 a 时将文件添加到索引rebase --interactive(如git rebase手册页GitHub rebase 帮助页面或此git rebase 交互式提示文章中所述),但不执行其rebase本身。
(除非如您所见,您在“工具”部分中自己定义了命令)