简体   繁体   中英

TFG/Git cancel merge conflict cause lost of previous commit

I successfully committed and pushed the latest code to the TFS git repository.

When I tried to sync the branch several hours later, VS2015 Team Explorer popped up a merge action with many conflicts.

I cancelled the merge.

This caused my commit to be lost. All my code in the last commit is gone.
Does anyone had this problem?
Is it possible to recover my previous commit?

Undo the merge will only block the sync action in TFS. It will not affect the previous operation - committed and pushed the latest code to local TFS git repository.

One of the most possibility could be you didn't commit successfully earlier. Code lost that never made it into source control is lost. Even though Git allowing you to commit to local repo before pushing to the server, allowing you to rollback/forward locally. But if you hadn't committed successfully locally, the issue is related to local repo not source control system(TFS), you could only try some recover git command such like the git reflog as VonC suggested.

Also suggest you to commit/check in locally more often.

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