u/chisui

▲ 12 r/bash

fast alternative to find for finding git directories

Hey,

I have a small script to switch between projects. All my projects are in a deeply nested directory that is equal to their upstream source (eg. ~/projects/github.com/junegunn/fzf/).

It works by using find to enumerate all directories under ~/projects/ that contain a .git/ directory and passes that to fzf. Unfortunately this is pretty slow somehow because findtakes a long time. When using fzf directly it's super fast, but I can't restrict the selection to only include git root directories.

Is there a better way of getting a similar result? All I want is to have a fast way of switching between projects

dev () {
    project="$(find $HOME/projects -type d -name .git -prune -exec sh -c 'dirname $(realpath --relative-to $HOME/projects {})' \; 2>/dev/null | fzf -1)" 
    if [[ $? -ne 0 ]]
    then
        return $?
    fi
    projectDir="$HOME/projects/$project" 
    pushd $projectDir
}
reddit.com
u/chisui — 4 days ago
▲ 105 r/NixOS

I just updated a system from NisOS 22 to 25 and holy shit. It just worked. All I had to do was rename some things, which nix told me about and everything from drivers to hardware config is working correctly.

This is the only distro I have used where a major version update didn't break something. NixOS just did three major versions in one go without a hitch.

Just wanted to express how impressed I am. That's all

reddit.com
u/chisui — 18 days ago