Home > Software engineering >  Git - pull file only if not already present
Git - pull file only if not already present

Time:07-12

I have a project in my repo and it contains 3 sqlite database files. When I pull the repo on a pc, I need to download those files to in order for the program to work.

But once the files are present locally, I do not want to overwrite them on new pulls. Is there a way to ignore those files only if they already exist? And is there a simple way to force the pull anyway in case of big structural changes?

CodePudding user response:

I think git pull --autostash might be an option for you.

It stashes the existing changes before pulling applies the stash after pulling, therefore the files are not overwritten by the pull.

For more information see the git pull options

Note: This does NOT ignore the files while pulling, but the "dirty" files should not be changed by the pull.

  • Related