Git Unstaging - RM or Restore? Why we have different options

Опубликовано: 05 Октябрь 2024
на канале: A shot of code
95
10

Git gives us two different commands to unstage file changes depending on the state of the repo.

1) rm --cached which simply removes the file from the staging/index area
2) restore --staged which resets the file to the version in the repo

Which one is displayed depends on whether we have any commits in the repo, so with no commits we'll be told to use rm --cached as there is no HEAD to restore too, and if we have commits in the DB the restore --staged is specified as the command to use as otherwise we'll remove the file from the staging/index area which will end up with git status showing us 'deleted' and 'modified'


Смотрите видео Git Unstaging - RM or Restore? Why we have different options онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь A shot of code 05 Октябрь 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 95 раз и оно понравилось 10 людям.