Android Studio development chapter 4 Version Management Git (II) and androidgit
The previous section describes how to associate a remote repository in as. This section describes how to apply the repository in the development process.
Submit + Push
If the local development code has been changed or you think a function has been completed, you are planning to submit the changed code to the remote repository. This is very simple,
Find the VSC arrow up button in the toolbar.
In this case, the commit changes dialog box is displayed, and the following blue Commit button is displayed. Click the drop-down triangle on the right and select Commit and push.
After the local commit is successful, the push commit dialog box will pop up. Click push to push it to the remote repository.
Update + Pull
We directly change the code in the remote repository to simulate others' code submission:
In this case, press the down button in the toolbar VSC to bring up the following dialog box:
If you do not know how to choose this option, click the Help button. The link will open to show you the functions of the buttons.
Failed. No trace branches...
Follow the previous knowledge to start pull:
No available branches ,,,?
Based on previous knowledge, fetch
OK, fetch is still very easy to succeed.
Then, merge changes:
This box is a bit like the pull box, but here the merge branch can be selected.
Merge is successful.
At this time, click the downward VSC button to succeed:
OK. You can click the VSC buttons in the toolbar.
Try again, change the file again in the remote repository, and then pull.
This is also successful.
View status
In the Android Studio project, you can view various files on the project structure panel.
Black file: indicates that the file has been synchronized with the remote directory. If you change the file content, it will change to purple.
Red file or directory: indicates a file or directory not under version control. Of course, you can add it to control. You can use git/add to add it to version control. After successful addition, it turns green.
Green file: indicates that the file is submitted locally, but not pushed to the remote repository. How do you modify the Green file or the Green file before you push it to the remote end.
Purple file: indicates the file synchronized with the remote warehouse and has been changed locally.
First, I add a new file. This is a smart prompt from Android Studio. Do you want to add it to git version control.
Click here and you will see that the MyClass in the project file is changed from red to green.
The MainActivity is changed, and MyClass is newly added.
Submit at this time:
New 1 Modyfied 1 is displayed in the upper-right corner of the Commit Message, indicating a New file that has been modified.
At this time, press submit to pop up a Code Analysis dialog box, saying that some files have problems.
This shows that AndroidStudio is a powerful tool for code reconstruction and code analysis.
Of course, you can go back to Review or directly submit it at this time.
What if I want to submit an existing project file to git: After git/add, it turns green and then press commit to display the following window:
The. gradle directory is red, indicating that all files in this directory are not under version control.
Sharing the most cutting-edge Android technology is at the Android technology sharing club. Pick up your mobile phone and scan it. Follow my public account and I will recommend you with excellent knowledge articles or technologies!