Run git commands in shell script without change directory to repo -
i'm writing shell script (zsh) run git commands set of directories. of these projects .rvmrc
files can take while run. when cd
directory run command, activates .rvmrc
slows down script quite bit.
example command: $(cd $dir && exec git branch)
i either run commands without cd
ing directory in script, or temporarily deactivate .rvmrc
file cd
ing directory not run rvmrc.
any thoughts?
you can specify git working directory , .git
location:
git --work-tree=$dir --git-dir=$dir/.git branch git -c $dir branch
there environmental parameter available, please check manuals
Comments
Post a Comment