<span id="Label3"></p><p><p>Because Android Studio was developed based on IntelliJ idea, the plugins used are actually the IDEA. Idea and Android studio already have git plugins installed by default, so we can use them directly.</p></p>1. Configure Git<p><p>Although Idea and Android studio already have a git plugin installed, you also need to configure the Git installation directory.<br>File->settings->version Control->git<br></p></p>2. New Local Project<p><p>I'm Building a Java project here as a demo.<br></p></p>3. Create a new git remote repository<p><p>I use Oschina's cloud code here, Although GitHub is mainstream and international, but relatively github,oscgit at home, bandwidth access is faster and more stable than github.<br></p></p>4. Initializing the Project<p><p>One convenient place for idea is that it comes with a command-line window and is automatically in the project Directory.<br></p></p><p><p>If you are using Git for the first time, configure the global user name and mailbox</p></p><pre class="prettyprint"><pre class="prettyprint"><code class="language-bash hljs "><span class="hljs-string">"用户名"</span><span class="hljs-string">"邮箱"</span></code></pre></pre><p><p>Initialize git</p></p><pre class="prettyprint"><pre class="prettyprint"><code class="language-bash hljs ">git init</code></pre></pre><p><p>Results<br></p></p><p><p>At the same time idea will prompt you to register as a git project, we check "Add root"<br></p></p>5. Using The. igonre Plugin<p><p>The plugin is a way to filter files and folders that are not submitted to git through a view, which is recommended for everyone to Use.</p></p>1. installation<p><p>Enter settings<br><br>Search for ignore, Click Install on the right (as I have already installed, so there is no install button on the right), you need to restart idea or Android Studio after successful installation<br></p></p>2. use<p><p>Add. Gitignore File<br></p></p><p><p>Selecting your own programming language automatically writes the associated filtered file suffix.<br></p></p><p><p>Right-click on the file or folder you want to filter and select "add to. gitinore file", and the files will be grayed out after they are added, indicating that they have been filtered.<br></p></p>6. Add files to the Git repository<p><p>When you need to add a file-right-click, the file appears green after success.<br></p></p>7. Submit to Local<p><p>Items-right-click<br></p></p><p><p>Check the files you need to submit (it is recommended to develop the habit of checking and submitting files, prevent unnecessary files from entering the warehouse, and cause unnecessary problems), fill in the submission log, click Commit.<br></p></p><p><p>After success, you can view the commit record in the GIT admin window.<br></p></p>8. Associated Remote Repositories<p><p>Because the view function of the associated remote repository is not available in idea, we use the command-line Implementation.<br>First we have to get the address of our remote repository,<br></p></p><pre class="prettyprint"><pre class="prettyprint"><code class="language-bash hljs ">git remote add origin 远程仓库的地址</code></pre></pre><p><p>Without an error, it means success.</p></p>9. Push Remote Repositories<p><p>Since we used the README.MD to initialize the warehouse when we created the new project, we have already submitted records and files for the remote repository, so we need to pull the remote repository to merge and Resubmit.<br></p></p><p><p>Pull Remote Warehouse<br><br></p></p><p><p>If there is no file conflict, idea is automatically merged and submitted Locally.<br></p></p>10.push Remote Storage<p><p>Items-right-click<br><br></p></p><p><p>If it is the first time the Push/pull project needs to enter a password, this password is a sensitive operation password, if not set will prompt you to set, your own settings will be good.<br></p></p><p><p>After the push succeeds, origin will be in the same location as the local Record.<br></p></p>Note: the file name in idea is not too color to represent different attributes, as Follows:<pre><pre><code>白色:已入库,未被修改的文件蓝色:已入库,被修改的文件绿色:新入库文件红色:未入库文件灰色:被过滤不需入库文件</code></pre></pre><p><p>At the end of this, the basic idea git operation, when creating a git project, is a bit more complicated, and after creation it's basically something: commit, pull, merge, Push.</p></p> <p><p>IntelliJ idea and using Git on Android studio</p></p></span>
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