- Importing some files across a branch
- Garbage collecting
- Editing history
- Making it work with a broken-permissioned FS
- Splitting off a sub-project
- Content-specific diffing
- Handy git commands
Git is remarkable for how smooth, fast, and tiny it is as a command-line application. Because of some as-yet unarticulated conservation law, this means that all the GUIs for it are clunky, slow, and bloated. To go from the magically simple experience of git to one with better visualisation and more discoverable UX, you must sacrifice time and disk space upon the altar of thread locks and bloat.
⭐️⭐️ ️️ I am intermittently auditioning smartgit after being dissatisfied with the gigabyte of RAM that GitKraken and SourceTree demand to do basic stuff. (closed-source, USD99/yr for updates, free for non-commercial use)
UPDATE: Apparently I deleted it for some reason too boring to remember. YMMV.
gitkraken seems to be the sleekest and hippest, and runs on Linux, macOS and Windows. It also has the least horribly broken visualisation. It uses gigantic amounts of RAM. Rebase support is weak, but it’s pretty functional apart from that. (closed-source, USD60/yr, free for non-commercial use)
⭐️⭐️⭐️⭐️ but it might delete your data on macOS.
SourceTree (closed source, free) is an adequate client on Windows and OSX, although it also uses gigantic amounts of RAM, and is slow in a particularly irritating way where the GUI controls keep on vanishing just as you are about to click on them. This could be improved by rebranding as a game of git-whack-a-mole, but my tickets about this are going unanswered. (Update 2018-10-12 this is greatly improved in the recent version.) Memory usage and responsiveness can be improved by restarting it every hour or two.
On the plus side, it also supports mercurial, which is nice if increasingly irrelevant. It has excellent interactive rebase support. But it might crash half way through said rebase.
On OSX it leaks file handles, which they claim is an OSX bug, although, since that bug dates to 2011, clearly most other developers have found workarounds with a better UX than posting snarky links to bug trackers blaming someone else. Their passive-aggressive manoeuvre of not working around the bug makes the developer (Atlassian) look like gigantic fuckknuckles, especially since the side-effects of said bug can include, in my own experience, significant data loss and file corruption in applications that are nothing to do with SourceTree.
git-cola is open-source, in python. Haven’t used.
giggle (open-source, Linux/GTK only) seems to be purely a repository viewer, but that’s actually done really badly generally, so this plus git CLI might be a sweet combination.
sparkleshare is designed for file syncing for designers, not versioning code for coders, but it is effectively a neat git GUI, with attention from designers which, as I have mentioned, is a weak spot in the bulk of offerings.
git fetch remote branch git subtree add --prefix=subdir remote branch --squash
git fetch remote branch git subtree pull --prefix=subdir remote branch --squash git subtree push --prefix=subdir remote branch --squash
Rebasin’ despite ‘em is slow and involved
Importing some files across a branch
git checkout my_branch -- my_file/
In brief, this will purge a lot of stuff from a constipated repo in emergencies:
git reflog expire --expire=now --all && git gc --prune=now
In depth explanation.
Cleaning out all big files
bfg does that:
git clone --mirror git://example.com/some-big-repo.git java -jar bfg.jar --strip-blobs-bigger-than 10M some-big-repo.git cd some-big-repo.git git reflog expire --expire=now --all && git gc --prune=now --aggressive git push
Deleting specific things
I think bfg also does this. There is also native support for that:
git filter-branch -f --index-filter 'git rm -r --cached --ignore-unmatch unwanted_files'open .
Making it work with a broken-permissioned FS
e.g. you are editing a git repo on NTFS via Linux and things are silly.
git config core.filemode false
Splitting off a sub-project
subtree split to prise out one chunk. It
has a few wrinkles but is fast and easy.
pushd superproject git subtree split -P project_subdir -b project_branch popd mkdir project pushd project git init git pull ../superproject project_branch
Alternatively, to comprehensively rewrite history to exclude everything outside a subdir:
pushd superproject cd .. git clone superproject subproject pushd subproject git filter-branch --subdirectory-filter project_subdir --prune-empty -- --all
jupyter diffing and merging is painful. Workaround: nbdime provides diffing and merging for notebooks. It has git integration:
nbdime config-git --enable --global
git-latexdiff, is the same for LaTeX.
Handy git commands
legit has simplified feature branch workflows.