git pull 在指定位置获取本地存储库(而不是 pwd)

标签 git

pwd 是“当前工作目录”。情况是这样的。

pwd:            /path/to/pwd/
git repository: /repo/path/.git/

我想从源做一个 git pull,但不改变我的当前目录。

为了防止我不够清楚,我要澄清一点,这是我想要的结果,但我想用一个命令来完成,而不必更改目录:

$ cd /repo/path
$ git pull origin master
$ cd -

最佳答案

git --work-tree=/repo/path --git-dir=/repo/path/.git pull origin master

关于git pull 在指定位置获取本地存储库(而不是 pwd),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9673176/

相关文章:

git - merge 后分支怎么办

git - 管理自托管存储库和测试的分支

Gitkraken 讨厌我在 SourceTree 中工作的 SSH key

git:未更新

git - 使用 Git 分离要修改的目录作为分支 elsewere

Git 提示和技巧 : Display Branch on Command Prompt not working and created side effects of git branch function not working and many others

Github 提交(推送) Gist

git - .gitignore 无法忽略以前未缓存的文件

python - virtualenv 不适用于 git bash MINGW32

ios - Xcode 机器人 : cloning multiple repositories before build