C A
C A

Reputation: 107

Files missing in Git repository

I didn't have backup of this code and its really important to me because I've been working on this since weeks but making it again from scratch will be time-consuming and mundane. Any idea how I could get it back? I didn't delete the local cloned repo or anything inside it. The local repo displays itself as being worth 302 MB but contains visible stuff worth only 46KB. Please help.

Upvotes: 2

Views: 8955

Answers (1)

C A
C A

Reputation: 107

First of all I would like to thank @bitoiu , @Fredric & @eckes for their help.

  • So basically when I added my codebase to an empty repository and committed, the commit couldn't be pushed because a video file in the codebase was larger than 100MB. On pressing "Undo the commit" I believed I lost all the codebase.

  • But actually what happened was it moved to a hidden .git folder
    within the repository.

  • To show hidden files under your repository, see this link : http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/

  • Then type git reflog to get present and past hash codes of the HEAD.

  • Then type git reset --hard <hash code of the commit that introduced the files> to populate all the missing files under your
    repository.More info about git reset and on the use of --hard can be found here : Whats the difference between git reset --mixed, --soft, and --hard? .

Upvotes: 4

Related Questions