Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I pissed in the pool GIT style - ftp'd files into repo now GIT not in sync

Tags:

git

github

Ok so here's the scenario:

  • Host the code on github - push to origin
  • For deployment - push to deploy (bare repo on bluehost that has a hook to push to www folder for all to see site)

So, workflow would be like this since I work at two different locations:

  • pull latest from github (changes made at different location and pushed the night before)
  • work locally and commit changes
  • push to origin (github)
  • after everything is good need this thing online, so master is pushed to deploy (bluehost)

Still with me?

This has worked for some time and for me it's awesome

Then I pissed in the pool

I accidentally ftp'd files to bluehost (sublime sftp was enabled), now when I try to push deploy the latest and greatest to bluehost I get the error that everything is up to date and if I make some changes, do a new commit then push, I get the error such and such file will be overwritten with merge, commit or stash ...

The local repo and the git repo are all in check, it's the bluehost one that is messed up.

Please help me fix this. I have tried googling this and reading other posts here but everything seems to not solve my problem. I tried push --force but to no avail.

Any ideas would be great. Or should I just erase the whole bluehost folder and start over with a brand new git repo to get things copacetic again?

EDIT: out put from 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
[email protected]'s password:
Everything up-to-date

Make an edit to single file (index.php

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
#

Commit change to 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(+)

push to github (works)

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

push to deploy (notice the other files that were ftp'd are there as well)

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 [email protected]:~/git/breadboard.git
9e9f3c1..e0be437  master -> master

C:\xampp\htdocs\www\testingboard>
like image 729
Danferth Avatar asked Jun 03 '13 22:06

Danferth


1 Answers

On the deploy server, use shell access and go to the www folder (the git repo checkout). Then use git status to get a list of files that are not in sync. Then use git checkout -- <paths> to restore those files from the git repo, so they're back in sync. Then you should be able to git pull on the server, or just git push deploy your local changes.

Since you're using a post-commit hook, the changes are already present in the bare repo on the deploy server but just not yet in the checked out www location. So a git pull there should get your webserver up to date.

like image 120
Arjan Avatar answered Nov 15 '22 23:11

Arjan