pedalpete
pedalpete

Reputation: 21556

git just deleted a bunch of files after refusing to merge to master

I'm no git master, that's for sure, but go through a fairly standard practice of

-git branch new_branch
-git checkout new_branch
#do a bunch of stuff
-git add .
-git commit -m "this is what I chanced"
git checkout master
git merge new_branch

I followed my regular routine, and after checkout master, I got an error

fatal: cannot create directory at 'app/assets/templates/users': Protocol error

it then said my local changes would be overwritten

I tried again with another add . and committed my changes again, but got the same error. I switched to my master branch, thinking maybe I needed to commit changes there if I had accidentally made a change before creating the new branch. so I did add . commit on master, and tried to merge new_branch again.

I somehow go to the point where I am in new_branch, and it has deleted everything that was originally in new_branch.

How can I get back to a previous commit? and any ideas why I'm getting the original can't create directory error?

Upvotes: 0

Views: 199

Answers (1)

RDL
RDL

Reputation: 7961

The directory creation issue is likely permissions on the directory git is trying to create the new folder in. Which OS/git client are you using (or command line)?

If the commits on your new_branch went through successfully then your work should still be on that new_branch. However since the merge did not work correctly it will not be seen in the master branch yet.

First try creating just the directory it's complaining about (assuming it's one of your directory and not git's) and make sure it has proper permissions. After that give the merge another try (just adding the directory into your working tree should not affect normal git operation).

Any other information you could provide would also help.

Upvotes: 1

Related Questions