Files
30-seconds-of-code/snippets/remove-file-from-commit.md
Isabelle Viktoria Maciohsek ee28929328 Make expertise a field
2022-03-01 20:23:46 +02:00

593 B

title, tags, expertise, firstSeen, lastUpdated
title tags expertise firstSeen lastUpdated
Remove a file from the last commit commit intermediate 2021-04-05T11:19:41+03:00 2021-04-13T21:10:59+03:00

Removes a file from the last commit without changing its message.

  • Use git rm —-cached <file> to remove the specified <file> from the index.
  • Use git commit —-amend to update the contents of the last commit, without changing its message.
git rm —-cached <file>
git commit —-amend
git rm —-cached "30-seconds.txt"
git commit —-amend
# Removes `30-seconds.txt` from the last commit