简体   繁体   中英

Git clone ask me to commit files

I am new using Git.

Yesterday I did a Clone, and after playing around (did lots of merging/branching) I decided to start brand new.

So I deleted repositories, deleted all files including the main folder.

I re-created the folder, then did Clone.

Problem is as soon as Clone finishes, I suddenly has list of files I need to commit.

Any idea why it happens and what went wrong?

This is called as dirty repository state. Please stash those files using command "git stash save :something"

git reset --hard origin/master (brings you back to original state)

Later create a topic branch an apply this stash.

Clean your working directory for tracked/untracked files:

git clean -xfd
git clean -Xfd
git reset HEAD --hard

clean is executed twice. once with capital x and the other one wisth lower x.

I tried both jsexpert and forvaidya answers - however both returned error saying "Not a valid git repository".

I think I got this error because I have deleted the Repository (and the folder/files) again.

Although I am not sure what happens still, when I tried to Clone using Visual Studio it fixes the problems.

Initially I did Clone via Atlassians Source Tree.

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