Dirk, (edited )
@Dirk@lemmy.ml avatar

I personally use yadm

I just use some code and Git.


<span style="color:#323232;">if [ ! -z "$PS1" ]; then
</span><span style="color:#323232;">    repo="${XDG_CONFIG_HOME}/dotfiles/"
</span><span style="color:#323232;">    br='origin/main'
</span><span style="color:#323232;">
</span><span style="color:#323232;">    title="e[1me[31mn ░▒▓e[7m    %s    e[27m▓▒░e[0mnn%snn"
</span><span style="color:#323232;">    status="$(git --git-dir="$repo" --work-tree="$HOME" status -s)"
</span><span style="color:#323232;">    diff=$(git --git-dir="$repo" --work-tree="$HOME" diff --stat --cached $br)
</span><span style="color:#323232;">
</span><span style="color:#323232;">    [ -n "$status" ] && printf "$title" "Uncommited changes!" "$status"
</span><span style="color:#323232;">    [ -n "$diff" ] && printf "$title" "Not yet pushed commits!" "$diff"
</span><span style="color:#323232;">
</span><span style="color:#323232;">    unset title status diff br
</span><span style="color:#323232;">    alias dotfiles="/usr/bin/git --git-dir=$repo --work-tree=$HOME"
</span><span style="color:#323232;">fi
</span>

The code runs when it’s an interactive shell with a PS1 prompt and just checks if any of the tracked files have changed or if there are commits that are not pushed. By configuration I ignore all untracked files. If something has changed or wasn’t pushed it always prints an annoying message.

Whenever I want to do something I use dotfiles … instead of git …, everything else works the same.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #