Git: find new cherries

人走茶凉 提交于 2020-01-06 08:17:06

问题


I've set up a process, based on Adam Spiers' answer in a previous SO thread, to periodically publish a Git repository to a path in an SVN repository. Everything is working quite well, but there's one piece I haven't figured out. When I'm grabbing subsequent Git changes using cherry-pick, how do I figure out which new changes have occurred on this Git side, needing to be cherry-picked into the SVN side?

To be more specific, after I do the initial push of the Git history into SVN, I'm now sitting on a master branch which has the same content & patch history as the Git origin, but it's diverged from origin/master for basically its full history:

% git --no-pager diff master git-svn
% git status
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 3 and 2 different commit(s) each, respectively.
#
nothing to commit (working directory clean)

Now, I do a fetch of new upstream changes:

% git fetch
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /cygdrive/c/foo/git/testrep
   6d7dd94..08d3d19  master     -> origin/master

At this point, I need to figure out which revisions need to be cherry-picked, then I'll cherry-pick them and do a git svn dcommit. But I can't figure out how to get that list of cherries. I've tried various git cherry commands, and both git cherry origin master and git cherry master origin report long lists of basically every change on each side.

Should I resort to parsing the last cherry-pick out of the log file? I'm using git cherry-pick -x, so I do have a record there.


回答1:


So I think I have a solution - after every git cherry-pick ... git svn dcommit round, I do a git tag -f last-picked origin. Then next time, I can cherry pick from last-picked to origin.

I'm willing to mark someone's answer as accepted if they have a better solution, but at this point it looks like I don't necessarily need another answer.



来源:https://stackoverflow.com/questions/13147373/git-find-new-cherries

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!