LucasLarson/gunstage

`git restore` requires `git --version` ≥ 2.23.0 or later

LucasLarson opened this issue · 5 comments

unstage="$unstage; git restore --staged --progress"

git restore is not available before Git 2.23.0

Either:

  • use old Git syntax, or
  • add the limitation to the readme.

add the limitation to the readme

and if adding the limitation, then check the user’s Git version à la ohmyzsh/ohmyzsh@c549387

and this is arguably better: it returns only the numerical output of git version

printf '%s\n' "$(git --version | awk '{print $3}')"

via

printf '%s\n' "$(git --version | awk '{print $3}')"

but it doesn’t actually work

but this appears to work:

if (printf 'minimum version 2.23.0\n'; git --version) | sort --version-sort --key=3 | tail -n -1 | grep --quiet git; fi