如何查看哪些内容已签入 git,但尚未通过 dcommit 提交到 svn?
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我使用
git log --oneline --graph
:很容易看到提交了
aaaaaaa
、bbbbbbbb
和fffffff
位于当前(主)分支上。这些提交要么已经提交到 Subversion,要么将在您下次执行 git svn dcommit 时提交给 Subversion。 (提交ccccccc
、ddddddd
、eeeeeee
位于已合并到 master 的单独分支上,并且不会作为单独的内容提交到 Subversion提交。)I use
git log --oneline --graph
:It's easy to see that commits
aaaaaaa
,bbbbbbb
, andfffffff
are on the current (master) branch. These commits either have already been or will be committed to Subversion the next time you executegit svn dcommit
. (Commitsccccccc
,ddddddd
,eeeeeee
are on a separate branch which was merged into master and will not be committed to Subversion as separate commits.)要查看提交列表,这是我的魔法:
输出:
To just see the list of commits, here's my magic:
output:
git svn dcommit
的--dry-run
选项对于准确找出将提交给 Subversion 的内容非常有用。特别是它具有以下属性:一般来说,在考虑使用
git svn rebase
之前是一个好主意code>dcommit,以便您的历史记录是线性化的 - 否则合并提交在 Subversion 历史记录中可能没有多大意义。 (如果你已经这样做了,那么 git log 和 gitk --all 也基本上是等价的,但我认为 git svn dcommit --dry-run 让您更准确地了解即将发生的事情,即使它更难以解释。)The
--dry-run
option forgit svn dcommit
is very useful for finding out exactly what will be committed to Subversion. In particular that has the properties that:In general it's a good idea to do
git svn rebase
before even thinking about usingdcommit
, so that your history is linearized - otherwise merge commits may not make much sense in the Subversion history. (If you've done that, thengit log
andgitk --all
will also be essentially equivalent, but I thinkgit svn dcommit --dry-run
gives you a more accurate picture of what's about to happen, even if it's more difficult to interpret.)我认为最简单的方法是使用 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:
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.