idea Git version rollback

This article on how to record the rollback in the version history of the project in IDEA and submit remote.

One,

Roughly divided into two steps:

The first step, roll back the native code;

The second step, the rollback remote code;

 

First, let's roll back the native code

Follow the steps in the figure below, you get to roll back history version number

Then the project root directory, right Git-> Repository-> Reset HEAD 

Reset Type There are three:

mixed by default, leaving only the source code, commit and rollback index information
soft roll back a version, only commit rollback information, and will not return to the index file level. If you have submitted direct the commit
Hard to completely rollback, will become a source of local content version

At this point we select Hard to completely rollback, click Reset will be able to roll back to native code version of the specified version.

 

Then we started to roll back the native code submitted to the remote repository, then there are two ways:

The first, direct forced to submit, submit using git git push -f command, but such records submitted after the rollback will delete all versions is not recommended to do so.

The second, in front of us with a way to roll back the local, roll back again to the latest version.

First of all, we get to remote branch latest version number

Then again, we Git-> Repository-> Reset HEAD time before some do not, we adopt Reset Type Mixed mode will retain the source, and then click Reset.

Finally, we have found that it is already an older version of the code, and the version or the latest version, this time after the regular filing push our local and remote code rollback is complete.

 

two,

1. Open submitted LOG, in the commit log, right-: revert.

 

 2, if there is a conflict, to merge. Then commit push.

3, the log will be retained.

Guess you like

Origin www.cnblogs.com/luoa/p/11729856.html