Using Android Studio to write code errors, sometimes you may need to fall back to a previous version of the project, which for many users who just use git may not be very understanding, the following for everyone to organize the Android studio Fallback code that has been committed and a program fallback method that uses Git to submit the code repository.
Androidstudio project How to use git version fallback
For a commit (not push) code to roll back, this block is a bit unfamiliar to developers who have just turned to git. Today I'm going to say something about this piece:
By convention, first, there is no commit of any code to the push interface, this time there is no commit any content:
I then modified the contents of the String.xml and executed a commit:
The next step is to say how to do revert commit, by selecting the project, right-click, select Git-->repository-->reset HEAD in the popup list ..., Some people might say that my right-click Pop-up list does not find Git options, which can be configured, please poke this:
Is there git in the right-click option for Android Studio?
Here's the analysis:
Git root: Select the directory you want to revert
Current Branch: Which Branch are you in?
Reset Type:
Soft: Choosing this mode means simply revoking a commit, without affecting any of your local files, or any files in the (index) cache.
Hard: Not only the content of the commit, but also the local file to your commit version, and index will also point to the version before the commit.
Mixed: This pattern is still a little blurry from my point of view. From my point of view is just roll back index, the rest is unchanged.
But here with everyone said, if you put the head behind a "to", here the number represents the number of times, such as you commit three times, you write 1, is to roll back the last commit, if it is 2, is the next two commits are rolled back. At this point you will find that its function is the same as the soft model.
I'll stick to the official statement: resets the index but not the working tree (i.e., the changed files is preserved but not marked for commit) an D reports what have not been updated. This is the default action.
Validate: This option is to see which files are currently affected and what the specific impact is.
My side executes the next soft mode, after the execution completes, looks, the just commit record has gone:
Of course, you want to use the same command line,
git reset [--soft |--mixed [-n] |--hard] head~x X: Number of Delegates
Androidstudio using Git Fallback project version method
1, need to import in the project is open, the project file, also submitted the project to the warehouse file, then you can click on the menu "CVS" option.
2. After clicking on the CVS option in the menu, a dropdown menu will pop up and the GIT option in the dropdown menu is displayed.
3, this will pop up a next level of the menu, in the next level of the menu to find a "reset HEAD" option, click to enter this menu.
4, pop up a reset head option, to put the project to the computer path, in git root to select the path. To confirm the version information that needs to be rolled back, you can click the "Validate" option.
5, pop up a previous version of the submitted over the file information, according to whether these files need to put these files back to the current project, after confirming the completion, click the Close window.
6, start to put the project back to the previous version, if you want to fall back to the previous version, you can put the head~1 in to commit, you can fall back to the previous version, click Reset to start fallback.
7, you can check the log information items from the code repository whether the rollback is successful, can be in the log information does not prompt the error message, is a successful fallback. You can also see whether the fallback was successful by code code.
Androidstudio project How to use git version fallback