Support common git-lfs workflows.
This is a generic issue to discuss getting tgits git-lfs support to the point where the average user will not have to fallback to the CLI when working with a LFS repo. I would appreciate input from other git-lfs users to confirm I haven't missed anything.
Originally this was posted in #2861 (closed)
I was hesitant to comment too much on this issue since I'm not exactly a LFS power user or anything but I'll tell you want would be needed to make git-lfs usable through tgit for my team.
Using git-lfs allows us to use git repos as a "backup" of entire websites. We call them backups atleast but what they are really for is to make local development of these sites easier and to keep a record of all the little changes/fixes that happen over the lifetime of a site. In the event of an emergency where we needed to restore a backup we have many non git based alternatives we would use first.
The reason LFS is used is it allows us to not only track the source code changes but also commit/track the sites binary files without causing the repo to become excessively bloated and slow over time.
Here's the list of cmds my team uses.
git lfs track&
git lfs untrack
This lets you track/untrack certain files/filetypes so they will start being treated as git-lfs objects. This tracking info is saved in a
.gitattributesfile in the repo root and it will create the file if it does not exist. Running
git lfs trackwithout any params will also spit out a list of current tracking patterns.
An example useage would be
git lfs track '*.png'which would end up adding
*.png filter=lfs diff=lfs merge=lfs -textto the
For tgit I imagine the best way to handle this is have it function in the context menus the same way adding things to
.gitignoreworks. There is already an issue about this cmd @ #2667
git lfs clone
This will automatically disable smudge filters and whatnot so it's much faster than a normal
git clonefor a git-lfs repo currently. My biggest use case for this is actually the
--include=params though. Which allows you to clone a repo while only downloading the binary contents of the LFS objects you want.
I almost exclusively run this cmd as
git lfs clone -X '*'. Which will exclude the binary contents of ALL git-lfs objects but it will still download the LFS pointer so the file structure of the repo remains exactly the same. This allows me to turn a clone of a 2GB website repo into a 30mb clone while still maintaining 90% of the functionally I need for development/debugging like searching the site or hosting it on a local dev ENV like vagrant/wamp/etc without having to worry about 404 errors. There is already a somewhat related issue about this cmd here @ #2861 (closed)
git lfs fetch&
git lfs pull
This lets you fetch the binary contents of git-lfs objects converting the pointers into the real binary files. It supports the same exclude/include params that
git lfs clonedoes.
In the above example I said I run
git lfs clone -X '*'90% of the time but later down the line I might need to do work that requires the real binary objects so that is where fetch comes in. For example if I'm doing graphic work I will need the real png binary content downloaded so I would run
git lfs fetch -I '*.png'.
There are also the
--recentparams but I don't really use them personally. The difference between
git lfs pull/fetchare pretty much the same as the difference between a normal
git pull/fetchbut with my workflow I use primarily fetch.
git lfs push
I'm not really sure if this does anything special over running straight
git lfs ls-files
This just spits out a list of sha1s/file paths of LFS objects. I don't really use it often but it's a super simply cmd that is perfect for a basic GUI window.
git lfs install
This explains it better than what I typed out. https://github.com/git-lfs/git-lfs/wiki/Installation
As I've said I'm a pretty lightweight LFS user so this is where the list of cmds I use/need end.
Here is a list of the git-lfs cmds I left off.
Commands -------- Like Git, Git LFS commands are separated into high level ("porcelain") commands and low level ("plumbing") commands. High level commands -------------------- * git lfs env: Display the Git LFS environment. * git lfs checkout: Populate working copy with real content from Git LFS files * git lfs fsck: Check GIT LFS files for consistency. * git lfs logs: Show errors from the git-lfs command. * git lfs status: Show the status of Git LFS files in the working tree. * git lfs update: Update Git hooks for the current Git repository. * git lfs version: Report the version number. Low level commands ------------------- * git lfs clean: Git clean filter that converts large files to pointers. * git lfs pointer: Build and compare pointers. * git lfs pre-push: Git pre-push hook implementation. * git lfs smudge: Git smudge filter that converts pointer in blobs to the actual content.