开发者

Git: keeping a project synced via mail

I'm developing a project on my personal computer (a Macbook). I'm using git to version it.

I have another computer (the one I use at work) where I'd like to develop the same project in daytime. I have a free account at github, so I could use it to keep the work going syncing home and work development, but th开发者_JAVA百科e project is not "public".

So, any way to work with git using email as syncing tool?

Thanks


You should also look into git-bundle. From the help:

Some workflows require that one or more branches of development on one machine be replicated on another machine, but the two machines cannot be directly connected, and therefore the interactive git protocols (git, ssh, rsync, http) cannot be used. This command provides support for `git fetch` and `git pull` to operate by packaging objects and references in an archive at the originating machine, then importing those into another repository using `git fetch` and `git pull` after moving the archive by some means (e.g., by sneakernet). As no direct connection between the repositories exists, the user must specify a basis for the bundle that is held by the destination repository: the bundle assumes that all objects in the basis are already in the destination repository.

Bundles are binary files but they are typically small since you don't need to include the entire repository and they're compressed.

Git Magic has some example usage too.


Take a look at git-send-email and git-format-patch.

EDIT: Pat's answer is better since it preserves the commit IDs.


You could probably use a small, portable USB key to hold a master repository for the project. Then you can update and sync it both at home and at work. This is easier than trying to manage using e-mail, in my opinion.


Git has some pretty powerful tools for automatically making patch sets and then even sending them for you. Or you can manually format them afterwards. I would spend some time reading the documentation on the Git website for some examples and information.


Have you considered using something other than email for syncing the project? If you are allowed to install it at work, you could use Dropbox to sync git projects between computers:

cd ~/Dropbox/git/
git init --bare my_project.git
cd ~/my_project/
git remote add dropbox ~/Dropbox/git/my_project.git
git push --mirror dropbox

Since the contents of ~/Dropbox are automatically synced between computers, you can then simply pull/push from/to the Dropbox repository on both machines, which IMHO is much simpler than using email.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜