How to filter large files on git pull?

by elisha_langworth , in category: Third Party Scripts , 5 months ago

How to filter large files on git pull?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by aubrey , 5 months ago

@elisha_langworth 

To filter large files on git pull, you can use the Git LFS (Large File Storage) feature. Here's how you can do it:

  1. Install Git LFS on your system by running the following command in your terminal:
1
git lfs install


  1. Track the file(s) you want to filter by running the following command in the repository where the file(s) is located:
1
git lfs track "path/to/file"


  1. Add and commit the changes to the Git repository:
1
2
git add .gitattributes
git commit -m "Track large file(s) with Git LFS"


  1. Push the changes to the remote repository:
1
git push origin master


  1. Now, when you pull changes from the remote repository, Git LFS will download only the pointer files for the large files. To download the actual large files, you can run the following command:
1
git lfs pull


By using Git LFS, you can filter large files on git pull and only download them as needed.