git restore

datajcthemax·2023년 6월 13일
0

git/github

목록 보기
7/18

The git restore command is used to unstage files from the staging area or to restore working tree files. It was introduced in Git 2.23 and is meant to be a more intuitive alternative to git reset and git checkout for these specific tasks.

Here are the most common uses of git restore:

  1. To unstage files: git restore --staged <file>: This command unstages the specified file from the staging area, but leaves the working directory unchanged. This is equivalent to git reset HEAD <file>.

  2. To discard changes in the working directory: git restore <file>: This command discards changes in the working directory for the specified file, bringing it back to the state of the last commit. This is equivalent to git checkout -- <file>.

It's important to note that git restore can permanently discard changes, so be careful when using it. Always make sure your work is committed or stashed somewhere safe before running git restore.

For more detailed usage, you can refer to the official Git documentation or use git restore --help.

0개의 댓글