如何查看哪些内容已签入 git,但尚未通过 dcommit 提交到 svn?

发布于 2024-11-08 02:24:42 字数 108 浏览 7 评论 0原文

我正在使用 git-svn。如何获取自上次 git svn dcommit 以来已提交到 git 但尚未提交到 SVN 存储库的内容的列表?也就是说,如果我执行 dcommit,如何验证将要发送的内容?

I'm using git-svn. How can I get a list of what I've committed into git, but haven't yet committed to the SVN repository since the last git svn dcommit? That is, how can I verify what is about to be sent if I do a dcommit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我不咬妳我踢妳 2024-11-15 02:24:43

我使用 git log --oneline --graph

* aaaaaaa commit message
*   bbbbbbb commit message 
|\  
| * ccccccc commit message
| * ddddddd commit message
| * eeeeeee commit message
|/  
*   fffffff commit message 
|\  
...

很容易看到提交了 aaaaaaabbbbbbbbfffffff 位于当前(主)分支上。这些提交要么已经提交到 Subversion,要么将在您下次执行 git svn dcommit 时提交给 Subversion。 (提交 cccccccdddddddeeeeeee 位于已合并到 master 的单独分支上,并且不会作为单独的内容提交到 Subversion提交。)

I use git log --oneline --graph:

* aaaaaaa commit message
*   bbbbbbb commit message 
|\  
| * ccccccc commit message
| * ddddddd commit message
| * eeeeeee commit message
|/  
*   fffffff commit message 
|\  
...

It's easy to see that commits aaaaaaa, bbbbbbb, and fffffff are on the current (master) branch. These commits either have already been or will be committed to Subversion the next time you execute git svn dcommit. (Commits ccccccc, ddddddd, eeeeeee are on a separate branch which was merged into master and will not be committed to Subversion as separate commits.)

长梦不多时 2024-11-15 02:24:43

要查看提交列表,这是我的魔法:

git svn dcommit -n  | sed 1d | cut -d" " -f3 | xargs -I{} git log --oneline --no-walk {}

输出:

c2e1eff changed a thing
a889dbf changed a second thing
18a4653 undid the second thing-- oops

To just see the list of commits, here's my magic:

git svn dcommit -n  | sed 1d | cut -d" " -f3 | xargs -I{} git log --oneline --no-walk {}

output:

c2e1eff changed a thing
a889dbf changed a second thing
18a4653 undid the second thing-- oops
乱世争霸 2024-11-15 02:24:42

git svn dcommit--dry-run 选项对于准确找出将提交给 Subversion 的内容非常有用。特别是它具有以下属性:

  • 它实际上并不向 Subversion 提交任何内容
  • 它告诉您将计算哪些差异以在 Subversion 中创建新修订
  • 它告诉您将提交到 Subversion 中的哪个分支 - 这有时并不明显,因为它是从第一个祖先提交中指定的 Subversion 分支中获取的,并在其提交消息中包含 git-svn-id

一般来说,在考虑使用 git svn rebase 之前是一个好主意code>dcommit,以便您的历史记录是线性化的 - 否则合并提交在 Subversion 历史记录中可能没有多大意义。 (如果你已经这样做了,那么 git log 和 gitk --all 也基本上是等价的,但我认为 git svn dcommit --dry-run 让您更准确地了解即将发生的事情,即使它更难以解释。)

The --dry-run option for git svn dcommit is very useful for finding out exactly what will be committed to Subversion. In particular that has the properties that:

  • It doesn't actually commit anything to Subversion
  • It tells you which diffs will be calculated to create new revisions in Subversion
  • It tells you which branch in Subversion you will be committing to - this is sometimes non-obvious, since it is taken from the Subversion branch specified in the first ancestor commit with a git-svn-id in its commit message

In general it's a good idea to do git svn rebase before even thinking about using dcommit, so that your history is linearized - otherwise merge commits may not make much sense in the Subversion history. (If you've done that, then git log and gitk --all will also be essentially equivalent, but I think git svn dcommit --dry-run gives you a more accurate picture of what's about to happen, even if it's more difficult to interpret.)

独行侠 2024-11-15 02:24:42

我认为最简单的方法是使用 gitk 来完成此操作。您将需要 --all 选项来查看所有分支。如果您之前没有使用过它,只需输入:

gitk --all

您将看到分支的图形视图。当您从 SVN 更新时,您实际上会执行变基 (git svn rebase)。这意味着任何未签入 SVN 的本地提交都将在上次 SVN 提交后出现在分支上。基本上查看远程 SVN 主干和主分支之间的提交。

The easiest way I think is to do this using gitk. You will want the --all option to see all branches. If you have not used it before simply type:

gitk --all

You will see a graphical view of your branches. When you update from SVN, you essentially do a rebase (git svn rebase). This means any local commits that are not checked in to SVN will appear on the branch after the last SVN commit. Basically look at the commits between your remote SVN trunk and your master branch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文