0

I have been working on a shared repository. The repository was entirely restructured by a team member. That made me losing my commits in a directory remotely(I have them locally). Now, looking into the commit history of that directory, it shows only the new commit 'restructuring'. I don't want to reset to previous state of my commit. I just want it to appear in commit history with the particular date before this new commit on the remote repository.

  • Why do you need the remote commits if you have them locally? Or you just want your local commits to _again_ be present remotely? – mnestorov Jun 29 '21 at 10:02
  • @mnestorov that commit is my project. I am trying to submit github project with my commits to a selective program. A reviewer demanded mainly with commit history. – Suman NayOo Jun 29 '21 at 10:09
  • Sounds like they force-pushed and discarded your commits from whatever branch that was on. You are lucky you still have them locally (on a local branch I hope)... or they could be gone forever... I guess you can still locally see your commits in some kind of common "history" with `git log --all -- dirname/`. That will show **all** commits of all branches. But if you want your commits to show up on github, you'll probably have to merge your local branch back into the "restructured" history (while discarding all file changes, so that you don't change anything other than adding the history). – Jay Jun 29 '21 at 12:03
  • @Jay No.. my lost commits are still in repo/commits/master (all commits of the repo). But they just don't appear in commit history of the particular directory where it shows only 'restructuring'. Are you saying that I have to delete that directory and commit it and push the whole directory again with a new commit? – Suman NayOo Jun 29 '21 at 17:28
  • @SumanNayOo No. This sounds weird. Maybe the exact spelling of the folder's name was changed? E.g. the case, folder was called `foldername` before and is now `folderName`? Those names may be "the same" on Windows, but not on other operating systems, git and probably github. If so you'll probably have to rename the folder back to the old spelling for the old commits to show up on github for that folder. But if the name was not changed at all, then it sounds like some weird github behavior. Or you use submodules/subrepos or other dark magic I do not understand :) – Jay Jun 29 '21 at 18:04

0 Answers0