oh-my-git/levels/low-level/index-remove

30 lines
492 B
Text
Raw Permalink Normal View History

[description]
To remove an entry from the index, use a command like this:
git update-index --force-remove <file>
Remove all entries from the index!
[setup]
echo "file 1" > file1
echo "file 2" > file2
echo "file 3" > file3
git add .
[setup goal]
echo "file 1" > file1
echo "file 2" > file2
echo "file 3" > file3
git add .
git update-index --force-remove file1
git update-index --force-remove file2
git update-index --force-remove file3
[win]
test "$(git ls-files | wc -l)" -eq 0