Is there a way to do a git pull
that ignores any local file changes without blowing the directory away and having to perform a git clone
?
Git Pull – How to Git Pull While Ignoring Local Changes
gitgit-pull
gitgit-pull
Is there a way to do a git pull
that ignores any local file changes without blowing the directory away and having to perform a git clone
?
Best Answer
If you mean you want the pull to overwrite local changes, doing the merge as if the working tree were clean, well, clean the working tree:
If there are untracked local files you could use
git clean
to remove them.git clean -f
to remove untracked files-df
to remove untracked files and directories-xdf
to remove untracked or ignored files or directoriesIf on the other hand you want to keep the local modifications somehow, you'd use stash to hide them away before pulling, then reapply them afterwards:
I don't think it makes any sense to literally ignore the changes, though - half of pull is merge, and it needs to merge the committed versions of content with the versions it fetched.