Git pull 入 "remote"目录

标签 git

在 Git 中,您可以将给定目录克隆到给定目录:

git clone ssh://gitolite@dev.bipper.com:3687/com/bipper/kids/portal <dir>

当我运行我们的构建脚本之一时,“cd”命令会导致一些复杂的问题我想使用 git pull 这样的东西:

git pull <dir-to-the-git-folder>

因此在执行 pull (或获取/merge )时不必在 git 文件夹中,是否有可能以某种方式实现(我上面的示例不起作用)

最佳答案

我认为你应该看看 git-dir也许还有work-tree选项。您还可以使用 GIT_DIR/GIT_WORK_TREE如果您愿意,可以使用变量。

查看手册:

--git-dir=<path> Set the path to the repository. This can also be controlled by setting the GIT_DIR environment variable. It can be an absolute path or relative path to current working directory.

-work-tree=<path> Set the path to the working tree. It can be an absolute path or a path relative to the current working directory. This can also be controlled by setting the GIT_WORK_TREE environment variable and the core.worktree configuration variable (see core.worktree in git-config(1) for a more detailed discussion).

关于Git pull 入 "remote"目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12473707/

相关文章:

git - 自动构建 .mailmap 文件的工具

git - 在 TFS 2013 上自动创建 git 存储库

git - fork 一个 git repo 的目的是什么?

git - 如何为特定的一组提交创建多个 PR

python - Heroku django "OSError: [Errno 2] No such file or directory: '/static/static'"

javascript - kflorence jquery 向导 : branch validation

git - 如何在一个 git 存储库中找到最新的提交?

git - 如何在大型提交中找到单个重大更改

git - 在 Github-Dockerhub 上自动构建的 Docker 工作流程

windows - .git 文件夹是跨平台的吗?