Hacker News new | ask | show | jobs
by uasi 3 days ago
Git works until you need conditional logic such as platform-specific files or templating.
2 comments

There are various options:

You can make forks or branches. Perfect for separating your work specific or private configs

You can use a filter like https://github.com/darkfeline/qualia-go

You can use a shell script (stored in the same git repo). You need you run an external tool with dotfile managers anyway, a shell script gives you more flexibility and doesn't need an extra dependency which might break at an inopportune time. The last thing you need is your dotfile manager breaking when you're setting up a new machine (ask me how I know)

You can, but forks or branches need constant merging or rebasing (and sometimes conflict resolution) for each one. Clean/smudge filters are fiddly to set up correctly and almost certainly require shelling out to another program, which could break. The second-to-last thing you need is your hand-rolled solution breaking on a new environment. If and when you need several advanced features that a stable dotfiles manager already covers, why roll your own?
I'm multi-platform and use git. A few scripts include things like this, but for the most part are portable.

    # fish
    if set -q TERM_PROGRAM  # mac os
       ...
    else if test "$COLORTERM" = "kmscon"
        ...
    else  # tron leotards
        ...
    end

    # bash
    if test "$WAYLAND_DISPLAY" == ""; then  
        echo X11
    else
        echo Found Wayland
    fi

    if test -e /etc/fedora-release; then
        echo ...
    else
        # Debian
    fi