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
?
Look at git stash to put all of your local changes into a "stash file" and revert to the last commit. At that point, you can apply your stashed changes, or discard them.
shortest way to do it is:
git pull --rebase --autostash
I usually do:
git checkout .
git pull
In the project's root folder.
git fetch --all && git reset --hard origin/master
.gitignore
"Adding unwanted files to .gitignore works as long as you have not initially committed them to any branch. "
Also you can run:
git update-index --assume-unchanged filename
https://chamindac.blogspot.com/2017/07/ignoring-visual-studio-2017-created.html
You just want a command which gives exactly the same result as rm -rf local_repo && git clone remote_url
, right? I also want this feature. I wonder why git does not provide such a command (such as git reclone
or git sync
), neither does svn provide such a command (such as svn recheckout
or svn sync
).
Try the following command:
git reset --hard origin/master
git clean -fxd
git pull