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 cding directory in script, or temporarily deactivate .rvmrc file cding 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

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -