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

6 lines
252 B
Plaintext
Raw Normal View History

2021-11-11 11:15:41 +00:00
#!/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