1

By mistake, i modified an old commit. For example, a->b->c->d->e->f->head is the commit numbers. and i modified commit C. Now i realized that one complete directory got deleted and it does not exist in subsequent commits(c, d, e, f, head). I have that directory somewhere else(on disk) so i can copy it back. The problem is, i have that directory(on disk) in latest state(head), i don't have separate directory for c, d, e, f. This directory content got changed in almost all the commits(c, d, e, f). So my commits c, d, e, f won't be working any more, if i put latest commit on c. is it possible to undo last 12 days commits? so that i can get previous state of my commits. Since 12 days, i have not committed anything on that branch, i have been working on some other repository and trying to fix issue with this repository.

  • yeah, all the commits a, b, c, d, e, f, head are in remote repository. If they had been in local repository, i would not be having such problem. – Pawan Yadav Sep 21 '17 at 14:54
  • See if this helps: https://stackoverflow.com/questions/4114095/how-to-revert-git-repository-to-a-previous-commit – veggirice Sep 21 '17 at 15:25
  • When you say "undo last 12 days commits", what do you mean: - undo the commits like they are now or: - revert the commit C to what it was before you modify it – matks Sep 21 '17 at 15:30
  • @matks By "undo last 12 days commits" means, to revert, to the state it was before 12 days. I don't care to revert to 12 days commit or something else. I want those directory and history of the file in the commit i modified and subsequent commits. If possible any way. – Pawan Yadav Sep 22 '17 at 16:31
  • @PawanYadav Maybe you can try to undo your `git rebase` as explained hre https://stackoverflow.com/questions/134882/undoing-a-git-rebase – matks Sep 22 '17 at 19:49
  • @matks thank you for sharing the link. reflog does not give much information, as i don't have the directory, i used, to mess up all things. This link won't help me much. – Pawan Yadav Sep 23 '17 at 16:17

0 Answers0