使用git-format-patch和git am查找工作流示例 [英] Seeking examples of workflow using git-format-patch and git am

查看:69
本文介绍了使用git-format-patch和git am查找工作流示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的学生使用git进行配对编程。因为学生的工作必须是秘密的,所以公共回购是不可能的。相反,每个学生都会拥有一个自己维护的私人回购站,他们需要使用git-format-patch来交换补丁。我已经阅读了手册页,但是我有点不清楚哪些补丁将被发送。对于学生来说显而易见的事情是发送自上次发送以来的所有补丁或(​​如果git不介意冗余地接收相同的补丁)从时间的黎明开始发送所有补丁。 (请记住,这些是学生项目,它们持续几个星期,并且规模很小,表现不是标准。)我们最好的朋友是简洁,我们喜欢暴力破解。



任何人都可以给我一些简短的例子,它们显示两个人,每个人都有一个私人的git repo,使用git-format-patch交换补丁,混帐上午?或者,也可以指向我现有的git文档和/或教程? 解决方案

git本身就是这样管理的(有一个公共仓库可供人们参考,然后他们从那里格式化)。如果人们永远看不到彼此的回购,事情会有点困难...



他们可以做的一件事是保持对上次他们做了一个格式补丁。假设他们首先发送整个树(包括.git): gzip -9vc> /tmp/mytree.tgz
#mail /tmp/mytree.tgz
git标记last-send
#hack,commit,hack,commit
git format-patch -M - C last-send ..
#mail 00 *&& rm 00 *
git tag -f last-send

git标签在这个表单中创建一个轻量级标签,它是一种书签,这对于人们追踪他们发送的内容很方便,因此他们可以在下次再次发送它。



另一方面:

 #从邮件中获取补丁并放入/ tmp 
git am / tmp / 00 *
rm / tmp / 00 *


I'm thinking of asking my students to use git for pair programming. Because student work has to be secret, a public repo is out of the question. Instead, each student will have a private repo they maintain themselves, and they will need to exchange patches using git-format-patch. I've read the man page but I'm a little unclear which patches will be sent. The obvious thing for the students would be send all patches since the last send or (if git doesn't mind receiving the same patches redundantly) send all patches since the dawn of time. (Remember these are student projects, they last for a couple of weeks and are small, and performance is not a criterion.) Our best friend is simplicity and we are fond of brute force as well.

Can anyone give me a short series of examples that show two people, each with a private git repo, exchanging patches using git-format-patch and git-am? Or alternatively point me to existing git documentation and/or tutorial?

解决方案

It works best if they can see each other's git repos. git itself is managed this way (there's a public repo people can reference, and then they format-patch from there). If people never see each other's repos, things are a bit more difficult...

One thing they may do is maintain a reference to the last time they did a format patch. Let's say they start by just sending their entire tree (including .git):

tar cvf - mytree | gzip -9vc > /tmp/mytree.tgz
# mail /tmp/mytree.tgz
git tag last-send
# hack, commit, hack, commit
git format-patch -M -C last-send..
# mail 00* && rm 00*
git tag -f last-send

git tag in this form creates a "lightweight tag. It's a sort of bookmark. This will be an easy way for people to keep track of what they sent so they can send it again next time.

On the other side:

# get patches from mail and place in /tmp
git am /tmp/00*
rm /tmp/00*

这篇关于使用git-format-patch和git am查找工作流示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆