Tuesday, September 29, 2015

Get latest files from master branch and overwrite local files

Peace be upon you,
Sometimes, I forgot to commit the local changes and after a few days when I opened the project, I getting lost of what I am doing, So I prefer to sync back my local files with current head from master branch and over write file locally then start coding back from fresh.

git fetch
git reset --hard origin/master
git clean -f -d

Using git fetch command will fetch and import commits from a remote repository into our local repo, then the git reset --hard origin/master will reset our index and working tree, any changes before this will be discarded.

No comments:

Post a Comment