【发布时间】:2020-09-23 09:35:57
【问题描述】:
这可能是非常基本的,但我还没有弄清楚:
我有一个 PHP 项目在两台服务器上运行,我们将它们称为 Live 和 Staging
两台服务器显然都在运行同一个项目,但有一些变化。
该项目在我手中时不在 Github 上,所以这就是我现在首先要做的事情。
我设法在 Github 上创建了一个新的远程存储库并将 Live 系统连接到它。
(通过将 Github 存储库添加为 Live 上的“来源”)git remote add origin https://github.com/path-to-repo/repo.git
因此 Live System 目前位于 masterbranch 上,并且与 origin/master 保持同步,origin/master 有 4 次提交的历史记录。
现在我也在尝试在 Staging 上连接 Github 存储库
所以我做了一个
git init
git remote add origin https://github.com/path-to-repo/repo.git
git remote -v
origin https://github.com/path-to-repo/repo.git (fetch)
origin https://github.com/path-to-repo/repo.git (push)
git fetch
现在,当我执行 git status 时,我看到 repo 仍处于初始提交状态,并且所有文件和文件夹都被列为未跟踪:
root@staging-host:/var/www/html# git status On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) .htaccess README.md _index.html api/ app/ composer.json global/ index.php package-lock.json package.json phpinfo.php system/ vendor/ view/
与origin/master 中的上次提交相比,我如何检查本地更改
我不想放弃任何本地更改,但也不想提交或推送任何内容
在逐个文件决定要提交什么以及要重置什么之前,我需要先检查差异
【问题讨论】:
标签: git github git-remote git-fetch