简体   繁体   中英

How to go back to latest remote commit git

我必须返回到本地的较早提交,因此我使用git reset --hard <tag>返回该提交,现在我该如何返回最新的提交(根据远程存储库) )?

Assuming that you have not done a fetch since your last sync with the remote tracking branch, then you should be able to reset your branch to what the latest commit was in the remote at the time you last synched:

git reset --hard origin/yourBranch

If you want to sync your branch with what the latest remote is, you can just try pulling:

git pull origin yourBranch

But make sure you commit all your work first, and expect that there might be merge conflicts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM