dotfiles/.local/bin/scripts/git-moves

6 lines
252 B
Bash
Executable File

#!/bin/sh
# Stage moved files fitting the already staged ones
git diff --name-only --cached >/tmp/staged
git add $(git rev-parse --show-toplevel)
git status -s | tail +2 | grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' | xargs git restore --staged