Some files lost when I add, commit, push and clone again

85 views Asked by At

I executed these commands on intranet server (initialized empty Git repository in /home/git/project/):

mkdir project
cd project
git init --bare

Then I executed these commands on client:

git clone git@server:project

Then copied android source code (directory: alps/) to project

git status
git add .
git commit -m "xxx"
git push origin master

When this operation was done, I deleted the project and cloned it from server again. Some files were lost (e.g.:some .mk files in alps/external/chromium_org)

Why did it happen?

1

There are 1 answers

1
Nick Volynkin On

Most probably you've got the .mk extension in your .gitignore file. The file is in the project root directory. It may be hidden.

If you're sure that you want .mk files under source control, find a line with it in the .gitignore and delete that line.

Then:

git add .gitignore
git commit -m'removed .mk from .gitignore'
git add --all
git commit -m'tracked .mk files'

By the way, a good sample of .gitignore for Android can be found in GitHub default .gitignore files.