0

I was doing some cleanup and accidentally deleted a folder.

then:

git commit -a -m  $VER
git push -f -u origin master

I'm trying to restore the folder but I don't see it in previous commits.

How to go back to previous commit?

Juancki
  • 1,793
  • 1
  • 14
  • 21
thstart
  • 397
  • 3
  • 15
  • check this link : https://stackoverflow.com/questions/4114095/how-do-i-revert-a-git-repository-to-a-previous-commit – jeankhawand Jun 08 '20 at 23:22
  • The problem is I am browsing in previous commits and don't see the files in this folder. I accidentally deleted the folder with files in my computer, pushed the commit and it deleted them on the server. I expect to see them on the server to restore them back. But I don't see the files. I see the folder but nit the files. – thstart Jun 08 '20 at 23:37

1 Answers1

0

Based on the tag google-cloud-source-repositories. You can see the history of your commits on your source repository page https://source.cloud.google.com/[YOUR REPO]

In the history tab you will see the changes made. You will need to go the previous commit of the deleted elements. Once you identify the commit, you can follow the answer in https://stackoverflow.com/a/4114122/6003934.Deleted subfolder

Juancki
  • 1,793
  • 1
  • 14
  • 21
  • The problem is as follows: 1) on my desktop - I accidentally deleted a folder 2) pushed to the cloud source repository 3) I don't see this folder anymore in the cloud source repository I'm looking back at previous commits - I see the folder name but not the content of the folder. – thstart Jun 09 '20 at 16:43
  • I deleted a folder with `git rm -r folder_name`, and the commit showed what I updated on the question. – Juancki Jun 10 '20 at 07:44
  • delete folder on your desktop, commit. There is no history in the Google Cloud Source Repository about this folder content anymore. Only the name of the folder. – thstart Jun 10 '20 at 15:26
  • I did delete the folder and commit it (this is what `git rm` does), if I go to the previous commit, i get the folder back. – Juancki Jun 11 '20 at 14:29
  • try the following - delete the folder on your desktop. Commit. – thstart Jun 11 '20 at 16:43
  • I'm not sure if I'm following you. Did you delete your folder from your desktop before committing? After reading the comments, I believe that the answer to "how can I go back to my previous commits" is already posted in this thread. Please update your question to show what things aren't working the way you would expect. – sllopis Jun 15 '20 at 08:23