Frage

I have a problem with a git repository. I will describe what I did.

  • I have created a repository in side an existing folder with files using the command git init
  • I added a remote with git add origin git @ ...
  • Instead of commit I used the command git pull origin master what override my files, files with an empty repository

Is there any way to restore my files?

War es hilfreich?

Lösung

a git pull is a fetch and a merge so is reversable for security checkout a new branch:

git checkout -b restore

then go back with

git reset --hard HEAD^
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top