2

New to git, just pushed my initial commit of a repo to Bitbucket, and untracked files in the .gitignore file were deleted locally. That wasn't my understanding of .gitignore - I simply thought the files wouldn't be pushed to the remote, and would still exist locally. Was wrong - all files are gone from local directory.

Lost a bunch of images and binary files that I didn't want uploaded, and some config files w/ credentials I needed.

Any way to get these files back? I wasn't on a branch, and there are no former commits to revert to.

Thanks!! Could save me hours of starting over.

tnrt
  • 131
  • 1
  • 1
  • 3
  • 1
    Git doesn't delete anything from your working directory, unless you tell it to. Were you using a GUI client to push to Bitbucket, by any chance? – Enrico Campidoglio Oct 05 '15 at 14:11
  • 2
    Did you say `git clean -x` by any chance? That explicitly deletes ignored files. – Wolf Oct 05 '15 at 14:57
  • 1
    The files that are untracked means , git isn't aware of them and hence won't delete them , until you do so explicitly. – cafebabe1991 Oct 05 '15 at 15:00
  • Did you ever commited those files? I mean if you eventually commited those files before you put them into .gitignore you can checkout last commit with those files and recover it. – gandra404 Oct 05 '15 at 15:09
  • I never committed them, so git/bitbucket had no record of it. I'm using Atom as my editor, and maybe that had something to do with the files going missing? – tnrt Oct 05 '15 at 17:54

0 Answers0