Home  >  Q&A  >  body text

在.gitconfig中设置参数 [alias] pre = !cd 某个目录;然后能运行但是不会跳转到目录下,求解

因为想快捷操作git;所以想用别名来解决结果无法实现:

然后再用 git pre 命令

并不会跳转到指定目录中

其他如 ls -a ;git pull等设置别名都没有问题
唯独 cd 命令不行……

習慣沉默習慣沉默2727 days ago603

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-02 09:46:27

    git alias is its own process, cd in the child process will not affect the parent process (your shell)

    You can write a shell function or shell alias

    reply
    0
  • Cancelreply