tags:

views:

40

answers:

1

Hi all,

I'm trying to script a 'git pull' at $dir. It should be the equivilent of 'svn update $dir'.

Does any one know any easy way to do this?

+1  A: 
#!/bin/bash

dir=$1
pushd $dir
git pull
popd

Note that if $dir is a subdirectory, this will update the whole tree, not just that subdirectory.

Matthew Flaschen
the problem with that type of solution is that git will call exit directly, so popd will never be called.
Keynan
I just tested (with bash), and it works as I would expect.
Matthew Flaschen
maybe its because i'm on windows. (wanders away in shame)
Keynan
i don't see why this wouldn't work on windows too (after you change it deal with the different syntax for arguments and environment variables). make sure you're using git.exe, rather than a batch/cmd file.
jdigital