William Entriken
William Entriken

Reputation: 39243

How do I git pull -f

Where is

git pull --force

as in rm -rf and then git clone again from scratch?

End result should be git diff returns nothing.

Upvotes: 11

Views: 7679

Answers (3)

Marco Leogrande
Marco Leogrande

Reputation: 8458

In addition to the other answers, I would also add a git clean -fdx to remove all untracked files and directories, to avoid potential issues with files being added in the remote repository, but also present in the current clone.

git clean -fdx
git fetch
git reset --hard origin/master

Upvotes: 19

robrich
robrich

Reputation: 13205

Reset your working directory back to the latest pull:

git reset --hard

Then pull as usual

Upvotes: 3

poke
poke

Reputation: 387587

You use git fetch to fetch everything from the remote repository. Then you can just git reset --hard origin/master to reset your current branch to origin’s master and reset your working directory.

Upvotes: 4

Related Questions