检测 git-svn rebase 后的冲突

发布于 2024-08-02 11:20:43 字数 461 浏览 4 评论 0原文

我(同时)使用了如此多的 git-svn 存储库,以至于更新它们变得很繁琐。我想编写一个脚本来自动执行此操作,这样我就可以每天早上在取咖啡时运行它。

基本上我的工作流程是这样的,

cd ~/module1
git svn fetch
git checkout master
git svn rebase

git checkout topicbranch
git svn rebase

cd ~/module2
git svn fetch
git checkout master
git svn rebase

我已经自动化了 git svn fetch 部分,可以随时安全地完成。但是自动执行 git svn rebase 不太安全,因为可能会发生冲突。

脚本如何判断变基后是否存在冲突?然后我可以运行 git rebase --abort,并向日志文件写入一行,以便我在喝咖啡回来时可以查看失败的情况:)

I'm using so many git-svn repositories (at the same time) that it's becoming a chore to update them all. I'd like to write a script that automates this, so I can just run it every morning while I fetch a coffee.

Basically my workflow is like this

cd ~/module1
git svn fetch
git checkout master
git svn rebase

git checkout topicbranch
git svn rebase

cd ~/module2
git svn fetch
git checkout master
git svn rebase

I've already automated the git svn fetch part, which can be safely done anytime. But it's not so safe to do git svn rebase automatically as there might be conflicts.

How can a script figure out if there was a conflict after a rebase? Then I could run git rebase --abort, and write a line to a log file so I can review the failures when I get back with my coffee :)

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

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

发布评论

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

评论(2

掩耳倾听 2024-08-09 11:20:43

执行“git svn fetch”后,您可以使用合并而不是rebase将最新的svn内容获取到本地分支。如果合并成功,您就会知道,因为没有冲突(您可以使用 git ls-files 等工具找到冲突)。如果合并不起作用,则说明您没有破坏任何内容,只需忽略对工作树的顶层更改即可。

然后在提交之前执行变基作为最后一步(如果您愿意;这不是严格需要的),并且您只能以交互方式处理容易出错的变基一次。

After doing "git svn fetch", you can use a merge instead of a rebase to get the latest svn stuff into your local branch. If the merge is successful, you'll know because there are no conflicts (which you can find with tools like git ls-files). If the merge doesn't work, you haven't mangled anything and can just ignore those toplevel changes to your work tree.

Then do a rebase as a last step before committing (if you want; it's not strictly needed) and you can handle the error-prone rebasing interactively only once.

梦幻的心爱 2024-08-09 11:20:43

据我从 git-svn 、 git-rebase 和 git-sh-setup 收集到的信息,git 将以退出代码 < code>1 如果由于冲突而无法执行变基。

From what I can gather from git-svn, git-rebase, and git-sh-setup git will exit with an exit code of 1 if the rebase can not be performed due to conflicts.

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