【问题标题】:Run git commands on remote working tree (GIT_WORK_TREE=/path)在远程工作树上运行 git 命令 (GIT_WORK_TREE=/path)
【发布时间】:2013-03-07 18:49:14
【问题描述】:

我设置了一个裸 git repo,它运行如下更新后挂钩:

GIT_WORK_TREE=/path/to/code git checkout -f

这在将代码推送到例如网络服务器时效果很好。我可以编写代码,完成后,更新网络服务器只需 git push live master 即可。

但是,我不知道如何回滚到例如特定标签。通常这可以用git checkout TAG 来完成,但是当我尝试签出一个标签(例如GIT_WORK_TREE=/path/to/code git checkout -f TAG)时,git 会响应:

error: pathspec 'TAG' did not match any file(s) known to git

关于如何在远程工作树上签出标签的任何想法?

【问题讨论】:

  • 你推送了那个标签吗? git push --tags
  • 我推送了主分支 - 不要在推送时标记“标记”?
  • 显然不是。我刚刚推送了标签,checkout 的选择多了很多!如果您在下面提供答案,我会接受。

标签: git


【解决方案1】:

要在远端签出标签,需要先推送:

git push --tags

正如“With GitHub how do I push all branches when adding an existing repo?”中提到的,即使git push --all 也不会推送你的标签,只会推送refs/heads/ 下的所有引用。

【讨论】:

    猜你喜欢
    • 2014-09-11
    • 1970-01-01
    • 2021-02-10
    • 1970-01-01
    • 2014-10-07
    • 2022-10-19
    • 2021-10-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多