Skip to content

Instantly share code, notes, and snippets.

@everttrollip
Last active April 3, 2025 02:49

Revisions

  1. everttrollip revised this gist Aug 11, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remove-git-lfs.md
    Original file line number Diff line number Diff line change
    @@ -24,4 +24,4 @@ git push

    Once your branch (fix/remove-lfs) is merged into develop, your team doesn't need to do anything other than simply pulling and checking out the new state of the world, their repository will work as-expected without git lfs installed. If git lfs is still installed, simply let them uninstall it: `git lfs uninstall`

    Credits: [Fedor](https://github.com/fedor57), [Taylor](https://github.com/ttaylorr), [Chase](https://github.com/chase-moskal)
    Credits: [Fedor](https://github.com/fedor57), [Taylor](https://github.com/ttaylorr), [Chase](https://github.com/chase-moskal), [Simon](https://github.com/altschuler)
  2. everttrollip revised this gist Aug 11, 2020. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions remove-git-lfs.md
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,11 @@ So, it has been an interesting journey, but time to remove git-lfs. Here follows
    * `while read line; do git add "$line"; done < files.txt`
    * run a `git status` and make sure all the files were added properly
    * commit everything
    `git add .gitattributes`
    `git commit -m "unlfs"`
    `git push`
    ```
    git add .gitattributes
    git commit -m "unlfs"
    git push
    ```
    * check that no lfs files left with `git lfs ls-files`
    * remove any lfs, `rm -rf .git/lfs`

  3. everttrollip created this gist Aug 11, 2020.
    25 changes: 25 additions & 0 deletions remove-git-lfs.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    So, it has been an interesting journey, but time to remove git-lfs. Here follows a summary of the approach I used to safely remove git-lfs,

    * commit & push everything
    * create a branch, something like fix/remove-lfs
    * remove hooks `git lfs uninstall`
    * remove lfs stuff from .gitattributes (open file, delete content - don't delete the file!)
    * list all lfs files, `git lfs ls-files`
    * run `git rm --cached` for each file
    * if your list is big, copy the contents into a file.txt
    * make sure you remove the number and asterik on each line, you only want the paths to the files
    * `while read line; do git rm --cached "$line"; done < files.txt`
    * run `git add` for each file
    * if you have a file.txt
    * `while read line; do git add "$line"; done < files.txt`
    * run a `git status` and make sure all the files were added properly
    * commit everything
    `git add .gitattributes`
    `git commit -m "unlfs"`
    `git push`
    * check that no lfs files left with `git lfs ls-files`
    * remove any lfs, `rm -rf .git/lfs`

    Once your branch (fix/remove-lfs) is merged into develop, your team doesn't need to do anything other than simply pulling and checking out the new state of the world, their repository will work as-expected without git lfs installed. If git lfs is still installed, simply let them uninstall it: `git lfs uninstall`

    Credits: [Fedor](https://github.com/fedor57), [Taylor](https://github.com/ttaylorr), [Chase](https://github.com/chase-moskal)