Cannot Restore Local Files From Remote GIT Repo

Viewed 38

I made a rookie error and reverted the same commit twice, which in the "git alternate universe" resulted in all of my local files on my test server being deleted.

Therefore on production server I ran a git commit on that added everything on the production server to a git commit.

Following this I used git fetch --all, which downloaded everything my local test server.

Problem:
I don't seem to be able to checkout the files or otherwise restore the files to their places on the test server.

Attempts
git checkout <remote>/master -f <-- doesn't work
git reset --hard <remote>/master <-- doesn't work

I have read this post, How do I force "git pull" to overwrite local files?

While I am sure the commit that I did on the remote server included all files, when I use git reset --hard <remote>/master I just get a message: HEAD is now at 8f894be all remote files, but no files in correct locations on local test server....

Any tips?

1 Answers

another rookie error..

The remote server's repo was collecting/holding files from a different working directory. Therefore, I had to use:

git --work-tree=/home/username/public_html/ add ../../* and git --work-tree=/home/username/public_html/ commit -m "don't a ninny" in order to properly commit the remote files before fetching them and checking them out locally with:

git fetch <remote> master

git checkout <remote> master -f

yes, its time to install a git gui...

Related