TortoiseGit 是否允许选择性暂存,例如 git-gui?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6971893/
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-19 05:47:24  来源:igfitidea点击:

Does TortoiseGit allow selective staging, like git-gui?

gittortoisegitgit-gui

提问by Brent.Longborough

This question:

这个问题:

Can you interact with the index/staging area with TortoiseGit?

你能用 TortoiseGit 与索引/暂存区交互吗?

takes the position that TortoiseGit's main function is notto eliminate the need for the git command line, and in general, I agree.

认为 TortoiseGit 的主要功能不是消除对 git 命令行的需要,总的来说,我同意。

However, git-gui has a feature I use a lot (maybe to compensate for bad workflow): the ability to selectively stage or unstage hunks or lines from the current patch in order to split a bunch of interspersed changes into coherent changesets in multiple commits.

但是,git-gui 有一个我经常使用的功能(可能是为了弥补糟糕的工作流程):能够从当前补丁中选择性地暂存或取消暂存大块或行,以便将一堆散布的更改拆分为多个提交中的连贯变更集.

The command-line alternative (for me, at any rate) is a bit clunky, so, ideally, I'd like to do the same selective committing in TortoiseGit.

命令行替代方案(无论如何对我来说)有点笨拙,因此,理想情况下,我想在 TortoiseGit 中进行相同的选择性提交。

So far I haven't found a way to do this, and I suspect, from the answer to the other question, that it isn't possible. Can anyone confirm this, please?

到目前为止,我还没有找到一种方法来做到这一点,我怀疑,从另一个问题的答案来看,这是不可能的。任何人都可以确认这一点吗?

采纳答案by Ivan Danilov

The only client on windows that has full support for selective staging in the GUI I've seen so far is SmartGit.

到目前为止,我见过的唯一一个完全支持 GUI 中选择性暂存的客户端是SmartGit

Thus said it has weak sides too, comparing to TortoiseGit or GitExtensions.

因此,与 TortoiseGit 或 GitExtensions 相比,它也有弱点。

For me, main showstoppers in SmartGit are:

对我来说,SmartGit 的主要表现有:

  1. Inability to compare two revisions. You could only see diff between one and its parent (TortoiseGit can that).
  2. Inability (well, it is somewhat strange, it is possible I didn't found the way) to limit log to some folder if I don't interested in everything (TortoiseGit can).
  3. Integration with VisualStudio (somewhat subjective, but GitEx have it and it is very handy)
  1. 无法比较两个修订版。你只能看到一个和它的父级之间的差异(TortoiseGit 可以)。
  2. 如果我对所有内容都不感兴趣(TortoiseGit 可以),则无法(嗯,这有点奇怪,我可能没有找到方法)将日志限制到某个文件夹。
  3. 与 VisualStudio 集成(有点主观,但 GitEx 有它并且非常方便)

I remember that there was something else, but evaluating last version of SmartGit now I can't find it. Either it was fixed/added or I just forgot what thing I can't do that time.

我记得还有其他东西,但现在评估 SmartGit 的最新版本我找不到它。要么是固定的/添加的,要么我只是忘记了当时我不能做的事情。

In any case I'm using both GitEx and TortoiseGit for some things and for everything else console is the best tool.

在任何情况下,我都将 GitEx 和 TortoiseGit 用于某些事情,而对于其他一切,控制台是最好的工具。

回答by Duncan Smart

Yes it does now: see issue 222- it takes the same approach as TortoiseSVN where you:

是的,现在是:参见问题 222- 它采用与 TortoiseSVN 相同的方法,您:

  • right-click on file, choose "Restore after commit"
  • TSVN creates a copy of the file outside the working copy, the file is shown differently in > the commit dialog (maybe an overlay icon or a different color)
  • user can double-click the file to open it in TMerge or some other diff tool and undo all the changes that should not be committed, then save those changes
  • commit
  • after the commit is finished, the copy of the original file is moved back

(From TSVN Issue 68)

  • 右键单击文件,选择“提交后恢复”
  • TSVN 在工作副本之外创建文件的副本,该文件在 > 提交对话框中的显示方式不同(可能是覆盖图标或不同的颜色)
  • 用户可以双击文件在 TMerge 或其他一些差异工具中打开它并撤消所有不应提交的更改,然后保存这些更改
  • 犯罪
  • 提交完成后,原文件的副本被移回

来自 TSVN 第 68 期

回答by VonC

From the look of issue 222, the "add -p" feature isn't implemented yet.

issue 222的外观来看,“ add -p”功能尚未实现。

Could you add support for partially committing a file? (git add -p).
I understand the way TortoiseGit works is a bit different from the normal "git index", but still I would like to have support for this in some way.

I'd love to commit only a few changes of a file.
For example, only commit a single line fix of the file, and leave the rest remaining in the working copy.

你能添加对部分提交文件的支持吗?( git add -p).
我知道 TortoiseGit 的工作方式与正常的“ git index”有点不同,但我仍然希望以某种方式对此提供支持。

我只想对文件进行一些更改。
例如,只提交文件的一行修复,其余部分保留在工作副本中。

回答by EwgB

SourceTree (https://www.sourcetreeapp.com/) has a very intuitive GUI for selective staging. It is made to integrate with BitBucket (it is by the same company after all), but can easily work with any git repository.

SourceTree ( https://www.sourcetreeapp.com/) 有一个非常直观的 GUI 用于选择性登台。它与 BitBucket 集成(毕竟它是同一家公司的),但可以轻松地与任何 git 存储库一起使用。

I do still use TortoiseGit in parallel, especially because of some nice features like the revision graph.

我仍然并行使用 TortoiseGit,特别是因为有一些不错的功能,比如修订图。