Android Tutorial, Part 2: Setting Up Git

Hi all! This is the second part of this tutorial series to teach newbies to develop apps for android using its native language Java and the official android IDE Android Studio. You are free to use and share, and spread this tutorial with or without permission as long as you would link and give attribution to the source material.

If you haven’t seen Part 1, please read that first

If you followed the previous tutorial, you will see something similar to this:


Yes, my windows is not activated yet, don't mind it.

Let’s try to run our app first. On the upper part of Android Studio, you will see the controls to run our app. Click on that ‘Play’ button.



Select an Emulator or a Device. Wait for the build to finish and you will see something like this.



Now, there isn’t much in our app right now, we’ll want to start building our app immediately right? No, we’re making a detour first. Let’s set up a Git repository first. Git is a version control system, this allows more than one person to safely work on the same project without overwriting each other’s changes, but it’s so much more than that too. I’m only one person following this tutorial, why would I need to use Git?

You’ve probably even done this yourself at some point, saving out copies of a project at different points so you have a backup. In a version control system, just the changes would be saved – a patch file that could be applied to one version, in order to make it the same as the next version. (http://www.makeuseof.com/tag/git-version-control-youre-developer/)

You might be thinking, what? I thought this was supposed to be an Android tutorial, why are you teaching me other things? Trust me, you’ll thank me in the future or just after this tutorial series for teaching you how to Git.

First download Git: https://git-scm.com/download/win Then install it.
After installation, go to VCS menu > Enable Version Control Integration



Select Git on the drop down menu then click OK.



Click on Fix It if you see this error:


Select the path to Git, this is typically in C:\Program Files\Git\bin\git.exe, then click OK.



Repeat the steps: go to VCS menu > Enable Version Control Integration, then it will show a confirmation bubble.



Everytime you add new files to the project, this dialog will pop-up. Just click Yes for now.



You will see a new tab named Version Control at the bottom right of your IDE.



Click on it, you will see Default and Unversioned Files. Default contains the files that we added to the VCS, Unrevisioned is vice-versa. Right-click Unversioned Files and click Add to VCS.


You will see that everything now added on Default. Now right click on default and click commit changes, type “Initial commit” on the commit message, then press commit. If you see a warning just press commit for now. Committing on Git means that you are telling Git to save a snapshot of your file and save it to you repository.



It will prompt for your Name and Email. Supply yours and click Set and Commit.



Then go to VCS > Git > Push. It will then “push” your “committed” changes to your current “branch”. Don’t worry, I will explain all this later when we are building features.



Make sure to select Push Tags then click Push.



Next tutorial Part 3
 
Last edited:

Latest posts

Top Bottom