Skip to content

Commit a20acf0

Browse files
committed
📝 Add the removal of git lfs
1 parent 0dad9ed commit a20acf0

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ emergencies when we need to start branches for older versions.
2323
Added
2424
~~~~~
2525

26+
* 📝 Add the removal of git lfs
27+
2628
* 🔧 Add vale
2729

2830
* Fix spelling mistakes

docs/productive/git/advanced/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Advanced Git
4444
jupyter-notebooks
4545
binary-files
4646
batch
47+
lfs
4748
vs-code/index
4849
gitlab/index
4950
git-big-picture
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Remove Git LFS
2+
==============
3+
4+
Services such as GitHub offer `Git LFS <https://git-lfs.com>`_ for their
5+
repositories, but these may not exceed the additional storage of 1 GiB.
6+
Purchasing additional quotas from GitHub is then quite expensive.
7+
8+
.. seealso::
9+
* `About storage and bandwidth usage
10+
<https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-storage-and-bandwidth-usage>`_
11+
12+
But how do you get rid of Git LFS in such a repository?
13+
14+
The following steps allow you to get rid of Git LFS:
15+
16+
#. Use ``git lfs ls-files`` to get a list of all files managed by Git LFS.
17+
#. Next, we make sure that we have checked out all large files with


18+
19+
.. code-block:: console
20+
21+
$ git lfs fetch --all
22+
$ git lfs checkout
23+
24+
#. Remove the Git LFS filters:
25+
26+
#. To do this, you must first remove entries such as ::samp:`*.{png}
27+
filter=lfs diff=lfs merge=lfs -text` from your :file:`.gitattributes`
28+
file.
29+
#. You can then stop Git tracking for each deleted entry in the
30+
:file:`.gitattributes` file, for example with :samp:`git lfs untrack
31+
'*.{png}'`.

32+
33+
Alternatively, you can also use ``cut -f 1 < .gitattributes | xargs "git
34+
lfs untrack {}"`` for all files managed with Git LFS.
35+
36+
#. Finally, the line ends should be normalised with ``git add --renormalize
37+
.``.
38+
39+
#. Now Git LFS can be uninstalled with ``git lfs uninstall``.
40+
#. Finally, the changes must be transferred to the server.
41+
42+
Now you can switch to Manage data with :doc:`DVC <../../dvc/index>`, for
43+
example, to manage large files in a versioned manner.

0 commit comments

Comments
 (0)