Completely overwrite local master with remote
If you need to completely replace the history of your local master with your remote master (for example, if you've been playing with commits or rebase), you can do so by renaming your local master, and then creating a new master branch.
This is achieved by doing the following:
#Rename your local master branch
git branch -m master _old_master_branch_
#Create a new master branch from a remote source
git checkout -b master remoateSource/master
Written by David North
Related protips
1 Response
If you don't need whatever you did in your local master
branch, I think this is simper (you don't need to delete your temporary branch afterwards):
git fetch remoteSource
git reset --hard remoteSource/master
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#