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

10 lines
329 B
Bash
Executable File

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