Restore
#!/bin/sh
: "Restore to unstage / Reset to undo commits
"
alias gs="git status | sed 's/^/\t/'; echo"
alias gsp="git status --porcelain | sed 's/^/\t/'; echo"
touch X Y
echo "touch"; gsp
git add .
echo "git add"; gsp
git restore --staged X
echo "git restore X"; gsp
git add .
git commit -qm 'm'
echo "git commit"; gs
git reset HEAD^ Y
echo "git reset Y"; gsp
git add .
git commit -mq 'm'
echo "git commit"; gs
rm X
rm Y
touch
?? main/basics/restore/X
?? main/basics/restore/Y
git add
A main/basics/restore/X
A main/basics/restore/Y
git restore X
A main/basics/restore/Y
?? main/basics/restore/X
git commit
On branch main
nothing to commit, working tree clean
git reset Y
D main/basics/restore/Y
?? main/basics/restore/Y
git commit
On branch main
nothing to commit, working tree clean
Last update: 450 days ago