Re: git for pushing local subdir to website

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 03 August 2009 13:13:43 Matt Di Pasquale wrote:
> wow. thanks. that gave me some good ideas.
> i think u were right about rsync. it was pretty easy to set up.
> assuming the name of my app is myapp, i just put the following alias
> in my ~/.bash_profile on my local machine.
>
> alias mapush='rsync -e ssh -av --exclude=".DS_Store"
> ~/Projects/myapp/myapp.com/
> matt@xxxxxxxxxxxxxxxxxx:projects/myapp.com/'

Okay, looks like you've got rsync figured out!

> btw, is there a way to make aliases that are local to certain
> directories? like typing mapush works from any directory. what if i
> just wanted the alias to be push and only work from within
> ~/Projects/myapp? is that possible?

The typical way to do this is to make a "bin" or "scripts" subdirectory of 
your project, then make a shell script and call it via ./bin/push or 
./scripts/push or whatever. You can also do pretty much anything by using 
shell functions instead of aliases. They work just like shell aliases but 
are defined differently (man bash, then search for FUNCTIONS).

Since the topic is git, I should also mention that you can also set up 
repository hooks that make things happen when triggered, e.g. automatically 
rsync to the server when you commit to "production" for example. Do a man 
githooks for more info on that.

> it's pretty fast. but will rsync be okay if i decide to move files
> around a bit? i know git is pretty good about that. and what if i
> delete certain files? will rsync delete them... like git does? guess
> i'll figure those questions out in time.

Rsync will not delete anything unless you add "--delete". If you use that, 
you probably also want "--delete-after" for a website, which makes sure that 
deletes are only done after everything else is copied over. The default is 
the same as "--delete-before", which does deletes before copying things 
(e.g. to save disk space).

As far as raw network transfer performance, git and rsync are probably 
pretty comparible, as they both are passing just changes instead of complete 
files around. Obviously they work very differently internally so e.g. I 
imagine that git will perform much better in some cases because it tracks 
content instead of files.

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]