如何使用 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
How to do a rebase with git 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 .gitconfig
file 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
:
- Go to
Tools -> Add
and then enter a custom command i.e.git rebase master
. - Select Add globallyto have this option appear for all repositories. (It will write the configuration to your
~/.gitconfig
for you, as @Ted-Percival mentioned in his answer).
- 转到
Tools -> Add
然后输入自定义命令,即git rebase master
. - 选择全局添加以使所有存储库都显示此选项。(
~/.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 vim
won't work, but gvim
will. You may use any gui editor, I use nedit
for 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 gui
can be used to add files to the index when doing a rebase --interactive
(as mention in thegit rebase
man page, The GitHub rebase help pageor in this git rebase interactive tip article), but not to perform the rebase
itself.
(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
本身。
(除非如您所见,您在“工具”部分中自己定义了命令)