git restores locally deleted folders to cancel added files

In a git project, some files or folders are sometimes added or deleted locally, but we do not want to submit them. In general, we cancel all local modifications:

git checkout .

To cancel the modification of the specified file:

git checkout  filename

To cancel the specified file deletion:

git checkout  filename

Reverting to the previous version will resolve the entire folder deletion modification:

git reset --hard HEAD^ 

Cancel locally added files and all modifications:

git checkout . && git clean -df

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324491461&siteId=291194637
Recommended