How to do git pull -f

Where

git pull --force

      

like in rm -rf

and then git clone

again from scratch?

The end result should be git diff

returning nothing.

+3
git


source to share


3 answers


In addition to the other answers, I would also add git clean -fdx

to remove all non-reproducible files and directories to avoid potential problems with adding files to the remote repository, but also present in the current clone.



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

      

+9


source to share


You use git fetch

to fetch everything from a remote repository. Then you can just git reset --hard origin/master

before reset point the current branch to the original master and reset the working directory.



+4


source to share


Reset your working directory will revert back to the last click:

git reset --hard

      

Then pull as usual

+2


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics