Nor*_*sey 9 git mirroring darcs
我正在尝试建立一个git存储库的darcs镜像.我有一些工作正常,但有一个重大问题:如果我将一大堆提交推送到git repo,那些提交将合并到一个darcs补丁集中.我真的想确保每个git commit都设置为单个darcs补丁集.我敢打赌这可能是通过某种方式git fetch
跟踪审查远程分支的本地副本,但我的git fu不能胜任这项工作.
这是我现在使用的(ksh)代码,或多或少:
git pull -v # pulls all the commits from remote --- bad!
# gets information about only the last commit pulled -- bad!
author="$(git log HEAD^..HEAD --pretty=format:"%an <%ae>")"
logfile=$(mktemp)
git log HEAD^..HEAD --pretty=format:"%s%n%b%n" > $logfile
# add all new files to darcs and record a patchset. this part is OK
darcs add -q --umask=0002 -r .
darcs record -a -A "$author" --logfile="$logfile"
darcs push -a
rm -f $logfile
Run Code Online (Sandbox Code Playgroud)
我的想法是
git fetch
获取远程分支的本地副本(不确定需要什么参数)我欢迎任何帮助充实上面的场景或建议我应该尝试的其他事情.
想法?
git remote update # fetch all remotes I like it better than just fetch
git log origin/master # can be any remote/branch
git cherry-pick origin/master # example remote/branch you can also specify a sha1
默认情况下,cherry-pick 将选择顶部补丁。
对于第三部分,我认为您必须编写一个脚本来为您完成它。还有其他方法来获取哈希值和许多日志选项。实际上,可能有一个用于cherry-pick的钩子,或者可能只是提交后...来运行darcs代码。查看 git hooks。
事实上,在这一点上,rebase 中应用的每个补丁都可能调用 git commit hook,因此您可以编写它,然后执行 git pull --rebase 并将该代码钉在每个应用上......
归档时间: |
|
查看次数: |
7968 次 |
最近记录: |