我在泳池里撒尿GIT风格-ftp';将文件复制到repo now GIT不同步 好的,下面是一个场景: 在github上托管代码-推送到origin 对于部署-推送到deploy(bluehost上的裸repo,它有一个钩子可以推送到www文件夹,让所有人都能看到站点)

我在泳池里撒尿GIT风格-ftp';将文件复制到repo now GIT不同步 好的,下面是一个场景: 在github上托管代码-推送到origin 对于部署-推送到deploy(bluehost上的裸repo,它有一个钩子可以推送到www文件夹,让所有人都能看到站点),git,github,Git,Github,因此,工作流程是这样的,因为我在两个不同的位置工作: 从github获取最新信息(在不同位置进行更改,并在前一天晚上推送) 在本地工作并提交更改 推送到原点(github) 一切正常后,需要将此东西联机,因此将master推到部署(bluehost) 还和我在一起吗 这已经有一段时间了,对我来说太棒了 然后我在游泳池里撒尿了 我不小心将文件ftp到bluehost(启用了升华sftp),现在当我尝试将最新和最好的文件推送到bluehost时,我得到一个错误,一切都是最新的,如果我做了一些更改

因此,工作流程是这样的,因为我在两个不同的位置工作:

  • 从github获取最新信息(在不同位置进行更改,并在前一天晚上推送)
  • 在本地工作并提交更改
  • 推送到
    原点
    (github)
  • 一切正常后,需要将此东西联机,因此将master推到部署(bluehost)
还和我在一起吗

这已经有一段时间了,对我来说太棒了

然后我在游泳池里撒尿了

我不小心将文件ftp到bluehost(启用了升华sftp),现在当我尝试将最新和最好的文件推送到bluehost时,我得到一个错误,一切都是最新的,如果我做了一些更改,请执行新的
提交
,然后推送,我收到错误,该文件将被合并、提交或隐藏覆盖。

本地回购和git回购都在检查中,是bluehost回购搞砸了

请帮我解决这个问题。我曾尝试在谷歌上搜索这个问题,并在这里阅读其他帖子,但似乎一切都不能解决我的问题。我试过推——强制,但没有用

任何想法都很好。或者我应该删除整个bluehost文件夹,然后用一个全新的git回购重新开始,让一切重新开始

编辑: 从吉特发出

C:\xampp\htdocs\www\testingboard>git status
# On branch master
nothing to commit, working directory clean

C:\xampp\htdocs\www\testingboard>git push deploy master
danferth@danferth.com's password:
Everything up-to-date
对单个文件(index.php)进行编辑 推送至github(works) 按需部署(请注意其他ftp文件也在那里)
在部署服务器上,使用shell访问并转到www文件夹(git repo签出)。然后使用
git status
获取不同步文件的列表。然后使用
git checkout--
从git repo还原这些文件,使它们恢复同步。然后您应该能够
git pull
在服务器上,或者只需
git push deploy
您的本地更改


由于您使用的是post-commit钩子,这些更改已经出现在部署服务器上的裸repo中,但还没有出现在签出的www位置。因此,
git pull
应该可以使您的web服务器保持最新状态。

请提供
git status
git push deploy
oh和+1的实际输出我的标题:-)更具描述性的标题可能会帮助其他有类似问题的用户在将来找到此问题。:)@灰胡子的怪人请查看我的编辑以获得输出。如果我对
index.php
做了一个新的提交,那么push会提示一个错误,即它将被merge覆盖,然后中止。有什么建议吗?你在本地的主分支上吗?@nzifnab是的,在本地的主分支上,我应该在本地的
工作
分支上工作并在github上推到
主分支上吗?我用putty进入
www
文件夹并做了一个
git status
,它返回了大量文件,猜测部署已经过时了,因为我一直在尝试修复问题。因此,尝试
git checkout
您建议并返回的单个文件
文件与git已知的任何想法都不匹配,谢谢您的帮助。在www文件夹中,执行
git checkout--.
-不要乱搞单个文件,也不要遗漏
--
部分。@danferth:如前所述,如果有很多不匹配的文件,请使用git签出--.
。@GreybearedGeek成功了!谢谢你们在这方面的帮助
C:\xampp\htdocs\www\testingboard>git add -A

C:\xampp\htdocs\www\testingboard>git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   index.php
#
C:\xampp\htdocs\www\testingboard>git commit -m "added mobile variable to index.p
hp"
[master e0be437] added mobile bariable to index.php
1 file changed, 5 insertions(+)
C:\xampp\htdocs\www\testingboard>git push origin master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 353 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://github.com/danferth/breadBoard.git
9e9f3c1..e0be437  master -> master
C:\xampp\htdocs\www\testingboard>git push deploy master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 353 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: From /home4/danferth/git/breadboard
remote:    9e9f3c1..e0be437  master     -> origin/master
remote: error: Your local changes to the following files would be overwritten by
merge:
remote:         .sass-cache/6329d896b0dd00f287815f75641600307d9f0023/css_didI.sc
ssc
remote:         _START/pageTitle.php
remote:         assets/custom_css/css_didI.css
remote:         assets/custom_css/css_didI.scss
remote:         content/p_didI.php
remote:         didI.php
remote:         index.php
remote:         template.php
remote: Please, commit your changes or stash them before you can merge.
remote: Aborting
remote: Updating 0dc9e3d..e0be437
To danferth@danferth.com:~/git/breadboard.git
9e9f3c1..e0be437  master -> master

C:\xampp\htdocs\www\testingboard>