Git

Git force pull

2020-05-07  本文已影响0人  JaedenKil

Setting the local branch to exactly match the remote branch can be done in two steps:

git fetch origin
git reset --hard origin/master
// Or if I want to make the local branch 'dev' to look exactly like remote 'origin/dev'
// First checkout to dev, then 'git reset --hard origin/dev'

But this reset will discard the local changes, in order to backup the local changes, before do reset:

git add xxx //add local changes
git commit -m "Backup local changes"
git checkout myLocalChangesBackup
// So the local changes will be stored in the new branch `myLocalChangesBackup` for backup
上一篇下一篇

猜你喜欢

热点阅读