这可能很基本,但是我还不能弄清楚:
我有一个在两个服务器上运行的PHP项目,我们将其称为Live
和Staging
显然,两台服务器都在运行同一个项目,但是有所更改。当它进入我的手中时,该项目不在Github上,所以这就是我现在首先要做的。
我设法在Github上创建了一个新的远程存储库,并将Live
系统连接到它。因此,实时系统当前位于master
分支上,并且最新的origin/master
具有4次提交的历史。
现在我正在尝试连接Staging
所以我做了一个
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状态时,我看到存储库仍处于初始提交状态,并且所有文件和文件夹都被列为未跟踪:
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
中的最后一次提交相比,我如何检查本地更改我不想放弃任何本地更改,也不想提交或推送任何内容我需要先检查差异,然后再逐个文件确定要提交的内容和要重置的内容
这可能很基本,但是我还无法弄清楚:我有一个PHP项目在两个服务器上运行,我们将其称为Live和Staging,这两个服务器都在运行同一项目...
[也许有更好的方法,但这应该可行。1. git添加。2. git commit -m'tmp'3. git diff HEAD起源/主4. git reset --soft HEAD〜1
您的方法几乎是正确的。看一下您的命令: