1
I have got an account on a server at my university. I want to share a program code with another student. I thought I should put it on my github account. Unfortunately, I cannot because the code is part of a contest.
I decided to make a Makefile so that we could easily upload and download files. After a while I finally understood that is not enough. Then I implemented patch system so that only changes are stored. There should be no problem with small simultaneous changes.
The Makefile almost do the job but there are some details I can't solve. The Makefile
all: download
PHONY: all, download, upload, getFiles
.ONESHELL:
getFiles:
rm ../.tmp -r
mkdir ../.tmp
@(ssh $(user)@host "tar c *") | tar xv -C ../.tmp
download: getFiles
@diff -u ../.tmp . | patch -p1
rm ../.tmp -r
upload: getFiles
@diff -uN ../.tmp . | (ssh $(user)@host "patch -p1")
rm ../.tmp -r
I removed all data from host. Now I want to upload but tar stops program because there are no files to download in order to find out changes.
Moreover, I cannot make my mind in the case: should I use -N in diff or not? Simply, I do not know how it behaves when I delete a file.
There is another problem: when something goes wrong the .tmp directory is not removed. The directory should be removed every time. Next action always download current "repository" status.
I fully recognize the fact it is not a repository, but I cannot set up a server program on the remote host and I think the Makefile will do the job for me.
Any hints will be appreciated.
Have you considered sending patches by email? – Daniel Beck – 2011-12-09T19:27:24.840
No. I think using makefile is much more convenient. – lord.didger – 2011-12-09T19:50:40.383
@lord.didger: Daniel meant "have you considered using git-format-patch / git-send-mail" ... and that in combination with commit-hooks. – akira – 2011-12-09T19:54:59.000
1Why not using a Git repository over SSH? – cYrus – 2011-12-09T19:57:21.237
1git over email? that would be the best option. Unfortunately, I have very basic knowledge of git. Getting know how to fire git over email will take some time. @cYrus: Git over ssh? what you mean? – lord.didger – 2011-12-09T20:02:07.410
@lord.didger: Server side:
git init --bare project.git
; client side:git clone ssh://you@your_host:project.git
. – cYrus – 2011-12-09T20:06:48.597Git over email is indeed possible; http://book.git-scm.com/5_git_and_email.html. Git was built with that in mind. However Git over SSH really is a good idea http://fclose.com/b/linux/366/set-up-git-server-through-ssh-connection/. Also, peek at this: http://book.git-scm.com/3_distributed_workflows.html
– Tyler Szabo – 2011-12-09T20:07:10.803Nice. I will surely try it but not now. Now I have no time - have to write some code. Checkout my question :) – lord.didger – 2011-12-09T20:14:09.587