friend
friend

Reputation: 1919

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?

Upvotes: 0

Views: 126

Answers (3)

friend
friend

Reputation: 1919

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.

Upvotes: 0

CodeWizard
CodeWizard

Reputation: 142064

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.

Upvotes: 1

forvaidya
forvaidya

Reputation: 3315

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.

Upvotes: 1

Related Questions