Skip to content

Commit

Permalink
📝 Add the removal of git lfs
Browse files Browse the repository at this point in the history
  • Loading branch information
veit committed Jan 18, 2025
1 parent 0dad9ed commit a20acf0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ emergencies when we need to start branches for older versions.
Added
~~~~~

* 📝 Add the removal of git lfs

* 🔧 Add vale

* Fix spelling mistakes
Expand Down
1 change: 1 addition & 0 deletions docs/productive/git/advanced/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Advanced Git
jupyter-notebooks
binary-files
batch
lfs
vs-code/index
gitlab/index
git-big-picture
Expand Down
43 changes: 43 additions & 0 deletions docs/productive/git/advanced/lfs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Remove Git LFS
==============

Services such as GitHub offer `Git LFS <https://git-lfs.com>`_ for their
repositories, but these may not exceed the additional storage of 1 GiB.
Purchasing additional quotas from GitHub is then quite expensive.

.. seealso::
* `About storage and bandwidth usage
<https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage>`_

But how do you get rid of Git LFS in such a repository?

The following steps allow you to get rid of Git LFS:

#. Use ``git lfs ls-files`` to get a list of all files managed by Git LFS.
#. Next, we make sure that we have checked out all large files with



.. code-block:: console
$ git lfs fetch --all
$ git lfs checkout
#. Remove the Git LFS filters:

#. To do this, you must first remove entries such as ::samp:`*.{png}
filter=lfs diff=lfs merge=lfs -text` from your :file:`.gitattributes`
file.
#. You can then stop Git tracking for each deleted entry in the
:file:`.gitattributes` file, for example with :samp:`git lfs untrack
'*.{png}'`.


Alternatively, you can also use ``cut -f 1 < .gitattributes | xargs "git
lfs untrack {}"`` for all files managed with Git LFS.

#. Finally, the line ends should be normalised with ``git add --renormalize
.``.

#. Now Git LFS can be uninstalled with ``git lfs uninstall``.
#. Finally, the changes must be transferred to the server.

Now you can switch to Manage data with :doc:`DVC <../../dvc/index>`, for
example, to manage large files in a versioned manner.

0 comments on commit a20acf0

Please sign in to comment.