gpt4 book ai didi

git - 将所有内容 pull 到 git 中的特定提交

转载 作者:行者123 更新时间:2023-12-04 16:49:38 25 4
gpt4 key购买 nike

我有两台服务器 - Staging 和 Live。
我让临时服务器保持最新状态,以便将所有最新更改推送到我的 git 存储库。
现在我想更新我的 Live 服务器,但我不想从我的 repo 中提取所有内容,而只是直到特定的提交。

当我做

git status

它说
# git status
# On branch master
# Your branch is ahead of 'origin/master' by 21 commits.
#

当我做
git checkout 7c7f78382fgh9e642d9b3298acacc5903410fefa

我收到一个错误...
fatal: reference is not a tree: 7c7f78382fgh9e642d9b3298acacc5903410fefa

知道什么可能是错的。

我需要把所有东西都 pull 到最新的然后 checkout 吗?

谢谢!

最佳答案

更清楚地说,您实际上应该检查分支的哈希值,否则您将处于分离的头部状态。

git fetch origin                        # Fetches commits from the remote repository
git checkout -b new_branch_name 7c7f783 # creates a new branch from this commit.

关于git - 将所有内容 pull 到 git 中的特定提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25117402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com