简体   繁体   中英

Unstage file in a git repo where there are no commits

Is there a way to unstage a file in a git repository with no commits?

If you try doing a git add . on a newly created git repo with no commits, and then try to do a git reset you get the following from git:

Failed to resolve 'HEAD' as a valid ref.

Is there an alternative method?

愚蠢的是,它在git status输出中正确:

git rm --cached -r .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM