Logan Bender Logan Bender - 1 month ago 7
Git Question

git : give me the repo, nuke everything local, I don't care

Does git have any pull/checkout 'nuclear option' to get the repo?
I don't care about any conflicts, I don't need any of my local stuff,
just want the goods so I can work.

[edit]
to clarify my issues:

$ git pull
error: Your local changes to the following files would be overwritten by merge:

<...files I couldn't care less about...>

Please, commit your changes or stash them before you can merge.
error: The following untracked working tree files would be overwritten by merge:

<...more files I couldn't care less about...>

Answer

Better for you to understand the various git commands then to just find the one you need "right now" as you will come up with this situation many times and just learn piecemeal while grumbling and blaming git.

EDIT: I went ahead and tried all the options and this should do it. Thanks to pauljz in the comments.

git clean -df # remove untracked files AND directories
git reset HEAD --hard # revert any uncommitted changes

The above should be all you need.

Other options:

git pull -f # replace local files even if you have unpushed commits.

or

git reset HEAD --hard # remove unchanged, uncommitted files
git pull

or

git clean -f # remove untracked files (uncommitted files)
git pull