git drop all local changes and commit and sync to remote server

There are times while working with git, you want to drop all your local changes and commit and sync the files to be same as the git server. The steps to follow are
1) fetch the latest history from the server
2) pointing your local master branch at it like this

git fetch origin
git reset --hard origin/master

if you want to do this for a branch, change the master with the branch name


Popular posts from this blog

phpbb3 Forum not showing after creating