[ACCEPTED]-how can i git clone git://foo.git AGAIN?-clone

Accepted answer
Score: 10
git checkout . # revert your changes
git clean -xdf # delete untracked and ignored files


Score: 2

To revert all your changes, use:

git checkout .

Untracked 9 files (files that didn't originally exist 8 in the tree, ones you created and not edited) will 7 not be removed, though. To find the untracked 6 files, use:

git status

Then delete them manually.

By 5 the way, if you'd like to make a copy of 4 the repo, you don't need to clone the original 3 repo, you can simply clone the one you already 2 have on your hard disk. Go somewhere outside 1 foo, and do:

git clone /path/to/foo
Score: 2

You can use "git checkout ." or 12 "git checkout HEAD -- .", or even 11 "git reset --hard HEAD" to reset 10 your working area to known state (to state 9 recorded in index in first case, to state 8 recorded in HEAD commit in second and third 7 case).

To delete untracked files you don't 6 want to keep you can use "git clean" (see 5 documentation for details).

To get new changes from remote repository 4 you cloned from, use "git fetch" (or 3 equivalent "git remote update", after 2 some setup), or "git pull" (to 1 fetch and merge changes).

Score: 0

If you really screw it up:

git clean -df
git reset --hard HEAD


More Related questions