[英]Run git commands in shell script without change directory to repo
I'm writing a shell script (zsh) that will run git commands for a set of directories. 我正在写一个shell脚本(zsh),它将对一组目录运行git命令。 Some of these are projects with
.rvmrc
files which can take a while to run. 其中一些是带有
.rvmrc
文件的项目,可能需要一段时间才能运行。 When I cd
into the directory to run a command, it activates the .rvmrc
which really slows down the script quite a bit. 当我
cd
到该目录中运行命令,它会激活.rvmrc
这确实减慢脚本不少。
Example command: $(cd $dir && exec git branch)
示例命令:
$(cd $dir && exec git branch)
I would like to either run the commands without cd
ing into the directory in my script, or temporarily deactivate the .rvmrc
file so cd
ing into the directory does not run the rvmrc. 我想运行命令而不将其
cd
进入脚本的目录,或者暂时停用.rvmrc
文件,以便使cd
进入目录不会运行rvmrc。
Any thoughts? 有什么想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.