Getting the code as it is from the remote Ideal way to do this is to not use pull at all, but instead fetch and reset. You can see in the example below: git fetch origin master git reset --hard FETCH_HEAD git clean -df