Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Track all files in a directory to git LFS but ignore a single folder present in that directory

Tags:

git

git-lfs

Say I have a directory "my_dir" and some files in it. And I have a subdirectory in it "my_dir_subdir".

File structure: "my_dir/my_dir_subdir".

How to track my_dir via git LFS but not track "my_dir/my_dir_subdir/" via git LFS

like image 794
Tejaswini Avatar asked Jun 08 '17 06:06

Tejaswini


People also ask

How do I exclude folders from Git repository?

Configuring ignored files for a single repository You can create a . gitignore file in your repository's root directory to tell Git which files and directories to ignore when you make a commit. To share the ignore rules with other users who clone the repository, commit the . gitignore file in to your repository.

Can Git track folders?

Git will only track Files and the changes in them. So folders are tracked as part of the file changes in them. In order to create an empty folder and commit it, there have to be some files inside it.

How do I ignore a file in Git?

If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a . gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.


1 Answers

Seems like you can disable a certain rule with preceding it with a hyphen:

*.png filter=lfs diff=lfs merge=lfs -text
Dependencies/*.png -filter=lfs -diff=lfs -merge=lfs -text
like image 145
Vladius Avatar answered Sep 18 '22 14:09

Vladius