0

I had added some files to my github repository some time back. Now I wanted to add more folder to the same github reposotory. I added them through terminal. I was able to add new folders but previous files are lost. I cannot revert changes back as I dont know the previous commit id.

anuja
  • 170
  • 1
  • 2
  • 11
  • Try `git log` in your dir in a terminal to know previous commits ids – Welgriv Nov 15 '19 at 12:06
  • I added previous files though github gui... – anuja Nov 15 '19 at 12:59
  • Maybe check `git log --no-merges -- path/to/lost/file` for some file history in the repo (technically, not really, it's in fact history of the *path* itself, not the file, but "files in git" is another subject). – Romain Valeri Nov 15 '19 at 13:17
  • Did you add the lost files to the remote repository on GitHub or the local copy on your device? – GoodDeeds Nov 15 '19 at 14:03
  • I dont have the lost files. I have lost them completely and want to recover it – anuja Nov 16 '19 at 15:52
  • The fact that you use GUI or command line have no matter of what's in your local git repository or your remote git repository (in your case on github). So to recover your files, i suggest 1) open a terminal 2) `cd` in your local git repository 3) `git log` to have a list of all commits and its ids 4) Go to a previous commit where you know your lost files exists (to do it read [this](https://stackoverflow.com/a/4114122/7758765) post) – Welgriv Nov 21 '19 at 09:14

0 Answers0