Problems with GIT

Asked

Viewed 195 times

0

I had some modified files in my branch path, but I didn’t update my archive.

Good but what happens is that I didn’t do the commit of the archives and I was obliged to give a reset throughout my branch, to update my repository.

The problem begins here:

It had many modifications many programs made ready to be sent to the server and I have no idea how to recover files in my branch local that have not even been made commits theirs..

Can someone help me ?

  • You came to give git add in the files before giving reset?

  • Here are several possible solutions, depending on your case (with commits, with adds, with new files, etc): http://stackoverflow.com/questions/5788037/recover-from-git-reset-hard

  • I didn’t give git add before reset or anything, the files were as modified status.

  • If you have not added in the repository you will not be able to recover those files! Deleted is deleted... unless it is in the recycle bin of your machine

1 answer

0


If the files were in "modified" status, they already existed on index Git, which is good news. You can recover all revisions of files that were saved but abandoned with the command

$ git fsck --lost-found

This command creates two folders inside your directory .git: .git/lost-found/commits and .git/lost-found/other and saved in these folders all the files that entered the GIT history when you saved, but that were not used, have no relation in the current project index.

Depending on how long this local copy has been used this may be a few hundred files, but there is a good chance you will recover at least part of your work there.

Of the manual:

git-fsck - Verifies the connectivity and validity of the objects in the database

--lost-found -  Write dangling objects into .git/lost-found/commit/ 
or .git/lost-found/other/, depending on type. If the object is a blob, 
the contents are written into the file, rather than its object name.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.