Comprehensive introduction to the use of Git in Android studio (i)

Source: Internet
Author: User

Comprehensive introduction to the use of Git in Android studio


Preface: This blog post will record how to use the GIT version control system in Android studio, the goods in the draft box has been put for at least two months, the old lie to think up the heart uncomfortable, simply this two days smoked some time, finishing out, the recent severe temperature drop, found themselves more and more lazy.


one, Git and GitHub

Here's what's the difference between git and GitHub.

Git: The Distributed version control system, originally used on Linux, can be understood as the same concept as SVN, CVS, and currently the most advanced Distributed version control system in the world (no one).

GitHub: A git-based project hosting platform, simply a website that allows you to use a git service after registering your account, which provides a Web page where you can create a resource warehouse, and synchronize updates with a remote project through a shell command or a graphical user interface. Manage the project. Still not very clear? is a project by a number of people to work together, in the development of the project files, everyone is likely to take the same file to edit, in order to co-development, there is like Git (version control) such things. GitHub, the equivalent of a project placement platform, but it has a lot of different open source projects, often a lot of people co-development, with the help of git to manage, compared to the Git local repository, it is a remote warehouse .


Second, install git

About the installation of Git can go online search installation tutorial, here will not repeat it.

Download Link: http://git-scm.com/download/


Iii. Create a local warehouse and submit code

You can use the graphical user interface of Git in Windows to create a local warehouse and manage your project, as well as using commands. As for the GIT client, you can download the installation online. Here, for example, you have installed a git client , let's do an example below:

1, first on the need as a repository of the directory right-click and choose Git Bash, the reason is in the current directory, is because the open command Operation box, the current is the root path, this individual, personal comparison lazy, save to open and then switch.

2. Enter git init at the command side to initialize a repository, which will generate a. git directory at the root of the repository, such as:


attached: The above mentioned can also be created using a graphical interface, open the Git Gui, choose to create a new version of the repository. As shown below:


3, ok! We've created the warehouse, and then we'll open studio, we'll configure Git, choose version Control in Settings and configure Git, not much, the previous figure:


After the configuration we click the Test button after the path, if the Success prompt box indicates that the configuration is successful:


Note: When we click on version control when we are configured, we will be prompted on the right side of the versioning tool used by the project, such as:


If the path is found to be gray, you need to select it and click "+"



Because we are a warehouse created on an existing project, you need to specify a version control tool for the project after the configuration is complete, or you can specify the warehouse path directly at the start of the Create project.


4, we will upload the project to the warehouse.

① at first, all the file colors of our project are [white: Normal file color]


② But when we specify the warehouse path for the project, the color of all the file colors changes [red: File not added after specifying the warehouse path]


③ Switch to Project view, right-click on the item, add File. (When creating a warehouse, the . Gitignore file is generated by default and can be modified to add files that need to be ignore)


After add succeeds, we look at the file color as [green: Add, but not commit file]


You can also view log log


④commit files are available through the project right---Git-to- Commit Directory ... You can also click on the two buttons on the toolbar.



Fill in the submission information, then commit and then push or select commit and push directly ...


Finally, when the submission is complete, because there may be some warning messages in the project, a prompt box will appear after submission, select Submit.

⑤ when we make changes to a class, we find that the file color changes again [ink Blue: Files modified after the submission was successful], and the project is uploaded to the warehouse, and log can be submitted through the view of version control at studio.



⑥ about how to pull down the code, we can click the button on the toolbar and select Merge merge in the popup box.

Do not know why, may be a blog post is too long or a picture or link too much, this article sent 2 hours did not send up, my side is prompted to publish the failure, the draft is not saved successfully, but the CSDN blog list shows 5-6 of the same title blog, and my blog list does not have these. And then from the CSDN blog list click into the content is empty, sorry ~ to bring dirty data for everyone. Now try to divide into two posts, no problem.

Next article:

Comprehensive Introduction to the use of Git in Android Studio (ii): http://blog.csdn.net/gao_chun/article/details/49817267


"Reprint Annotated Gao_chun blog:http://blog.csdn.net/gao_chun/article/details/49817229"


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Full Introduction to the use of Git in Android Studio (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.