The operation steps are as follows:
git reset --hard commit idFall back to a certain version
2. After the version was rolled back, the local code was modified without pushing to the remote.
3. push to remote after modification, prompt to pull first
The problem is that pull remote code will overwrite the local modification.
How can I operate to push the locally modified code to a remote location?
pull. . .
At first it was like this:
A-B-C-D remote A-B-C-D local
The first step,
git reset --hard B
A-B-C-D remote A-B local
The second step is to modify the local code and record it as e
A-B-C-D remote A-B-E local
Pull remote code
A-B-C-D remote A-B-E-D 'local
Among them, d’ includes changes to c and d because
git pullEquivalent to
git merge. At this time
merge“Fetched HEAD” means remote
D. At the same time,
D'The message of should have a “merge … from …..”
If you wish to be remote
A - B - E, then don’t
git push -f