I have a bit of a puzzle at my hands: several previously-committed files disappeared over night, but there is not a single commit that shows they were deleted. How could that happen?
The situation is as follows:
- I have a private Git repository on BitBucket, with a single branch.
- There are 3 other people in my team, and everyone is using SourceTree as their git interface.
- Yesterday I pushed a commit - and after it the repository was okay.
- Since then all 3 other team members pushed several commits:
- one was a local merge,
- two were online (ie. through-a-webpage)
README.mdedits, - one was online (ie. through-a-webpage) deletion of a single unrelated file,
- and the others were several commits with 1 or 2 files.
- In the morning, I pulled the repository, only to find several different files, which were committed by different people at different times, were gone from the repository:
- they are gone from the local copy,
- they are gone from the Source page on project's BitBucket website,
- they are gone from the .zip downloaded from the Downloads page.
- However:
- none of the commits after mine delete any of these files,
- I can go to an earlier commit that modified one the "disappeared" files, go to its summary page, view its history - and none of the commits in it deletes the file either.
- I double checked that nobody messed with
.gitignore, but it was untouched since last December.
Also, as to further confuse the issue: several months ago I added files A.R and test-A.R in a single commit. Later I renamed the test-A.R to test.A.R. Now A.R is still in the repository, but neither test-A.R nor test.A.R is still there.
So, what could possibly cause the files to be deleted from Git repository without any of the commits actually deleting them?
PS. Of course, I filed a support ticket to BitBucket Support, but I'm not terribly confident they'll respond quickly.
It is likely that somebody forced a push (ie
git push -f ...) meaning whatever is in their local history replaces the branch on the remote. There doesn't need to be a commit that deletes things, as you appear to assume. If a dev never synced their changes to see all the commits on the server and then force pushes their out-of-date history then you can lose commits. This is all assuming that by "private" repository you mean the devs in your small group can all write into the repo.I would adjust repo, branch, or project permissions so this doesn't happen again. Or you can require that all users use pull requests if you are ok with moving to a gitflow or feature flow approach. Also make sure your devs are educated on how to use Git.
Just a guess here but likely if everyone made changes but several people lost their commits, then my guess is that whoever didn't lose any commits is the person at fault.