admin管理员组

文章数量:1400674

Is it possible to get my files back? Knowing thay they were overwritten due to the clone, and I couldn't push it before. The commits I made earlier seemed to be taken into account but I have no traces of it.

I recently created a streamlit application running with a github repository.

I had an older version of the code in my repository and I wanted to update it with a newer version I had locally in a folder. So I linked my folder with my repository, and then I wanted to commit changes and then I tried to push it but it didn't work cause of many problems.

So, as I am new concerning github. I decided to ask ChatGPT (probably worst decision) and it ended up telling me to clone the older repo from github into my folder, so all of my files were overwritten with the older ones.

Is it possible to get my files back? Knowing thay they were overwritten due to the clone, and I couldn't push it before. The commits I made earlier seemed to be taken into account but I have no traces of it.

I recently created a streamlit application running with a github repository.

I had an older version of the code in my repository and I wanted to update it with a newer version I had locally in a folder. So I linked my folder with my repository, and then I wanted to commit changes and then I tried to push it but it didn't work cause of many problems.

So, as I am new concerning github. I decided to ask ChatGPT (probably worst decision) and it ended up telling me to clone the older repo from github into my folder, so all of my files were overwritten with the older ones.

Share Improve this question edited Mar 25 at 15:20 mkrieger1 23.5k7 gold badges64 silver badges82 bronze badges asked Mar 25 at 15:16 Jean BériotJean Bériot 131 silver badge1 bronze badge 2
  • You can restore anything which you have included in any commit. Otherwise, only with luck. – mkrieger1 Commented Mar 25 at 15:19
  • Luck or filesystem backups. – Jim Redmond Commented Mar 25 at 21:05
Add a comment  | 

1 Answer 1

Reset to default 1

If you had already committed your changes, it is likely that they remain in the git database (inside the .git folder).

To find them, you can use git log --graph --reflog. It will show a tree of commits, sorted by the date.

Once you find the hash of the commit you want, use git checkout to update the working tree to it.

本文标签: