Hello everyone and welcome to this section. Here we'll be going over how to integrate git with Android Studio and perhaps show you a little bit of tidbits on how to use git. So, let's dive right in. So, as you can see here we have our Android Studio open, and so we're going to go ahead and create a new project. And I think we should rename our application something more exact so let's do GitExample. >> Sounds like a good one. >> Notice you can also change your company domain and your project location. For the purposes of this section let's go ahead and keep it like this. And here you're able to, in this screen, you're able to choose what minimum SDK you want your Android application to work on. Since we'll be working on the DragonBoard, we're gonna choose Android Lollipop, and more specifically, API 21. And do note that if you choose a lower version of Android, you're able to accommodate more users. But that comes with a drawback in that there's some compatibility issues that you may run into. >> So the farther back you go, the more you have to take into account making sure it's compatible on all devices. And I think a blank activity will suffice for us. Notice we have different types of activities to choose from, blank will do for us. And what do you think we should call our activity? Instead of main activity, we should call it get GitExampleActivity. I think it's better representative of what we're gonna try to do. >> I completely agree with you there. All right, let's go ahead and create our project. Now, note that because Android is such a huge project, it may take a little bit of time to correctly configure and get going. For us, we're really lucky it got going really fast. So just a quick overview of the hierarchy. Your build tools or your Gradle scripts are gonna be located in this folder here. And most of your development code is gonna be located inside of this app folder. So let's go ahead and change the default which is to just show this hello world to something that is much more descriptive. But before we do that we should do some Git integration. So to do that, we're gonna go ahead and click on VCS up here, and we're gonna enable Version Control Integration. >> And here you're able to choose which type of version control system you want, for us we want to use Git so that's what we're gonna choose. >> If you're gonna use something else go ahead and choose that just remember that Git is kinda like the new trending version control system. So now notice that a lot of these are red, a lot of these files are all red. That means that they are currently not being tracked by Git. However we want to make them all trackable. So you can go ahead and right click each one of these. And go to Git and add but let's do a much more codey example. >> Yeah, and because this is a new Git new repository, none of the files are currently being tracked. Which is why we're going to issue the command git add -a. And this will just add all of the files currently in this root folder to be tracked. >> And now this -a is actually really cool because not only does it add all of them but it also keeps into account everything that you've removed. So in our case we haven't removed anything yet but in the future we definitely want to do that. All right, so now we added all of them, we just got to wait a little for them to update and notice now everything is green. That means everything in our repository is now up to date and trackable. All right, so before we make any changes, let's go ahead and do a quick initial commit. To do that go to VCS, and click on Commit Changes. Now we're gonna get a pop up dialogue which basically outlines all the changes that were made and we have a bunch of other options. At this moment in time we don't need to go too much into depth. We are also getting an option with a commit message. So, what do you think we should call it hear? >> Since it's our initial commit, I think it'd be appropriate to say that it is our Initial Commit. >> All right. [LAUGH] >> And that's a pretty standard very first commit for Git users. Go ahead and click on this Commit button. And it's gonna do some extra analysis and verifications just to make sure everything is right. Now, we're given an option that says, add files to Git. For our case it's fine, we can go ahead and add them. But now, let's say, we go back to our terminal. If we do a quick git status, we notice that there's two more files being tracked, but aren't being tracked by commits. So I'm gonna go ahead and do another commit. And here I'm assuming like add.IML files. Now here don't be tempted to say added.IML files. The way you want to view Git is a series of patches upon your initial code. So, when you say added it's kind of like past tense, not really descriptive of what Git actually does. It adds the .iml files in that specific revision. Remember, it starts off with the initial repository and adds the snapshots as time goes on. I'm gonna go ahead and say Commit. All right, now let's do another git status. Everything is clean and we're ready to continue programming. So, I feel like maybe we should just change that Hello World text. >> Yeah, I feel that we could think of a more appropriate and better text to welcome us with. Let's go ahead and change that. >> All right, I'm what I'm gonna go ahead and select the activity_git_example.xml file and set up our layout folder. Which is, in turn, included in the res folder. Next, there's two of the ways you can modify it. One, by clicking here and changing the text. Or the way I personally prefer is actually going to the actual XML file itself. You'll notice here that our text here is Hello world! Right here, which is in turn, an actuality called by string/hello_world. So let's go ahead and look at our strings.XML file. >> Here we'll notice that we have a bunch of different strings that are defined. And the one in turn that we want to modify is this Hello World string. So lets go ahead and replace Hello World here. What should we replace it with? >> Hello from the DragonBoard. >> Hello from the DragonBoard. And I'm assuming dragons make some sort of noise, like rawr. >> Sure. Le's add that in. >> All right, so we made our change. If we go back to our layout in design, we should note that the changes hadn't been effected. So, I think this looks pretty good, right. Let's go ahead and commit. So what should a good commit message be here? >> Commit messages, you really want them to be descriptive, but not overly descriptive. So in our case, we want to let our team know, our friends, or whoever is working with us in our repository, that we changed the text. So we can say we changed the text to a more appropriate example. >> So change text to be more awesome. I think that would be a good one. All right, so before I commit, actually you want to link this to a remote repository online. So, actually for now we can go ahead and click commit, just to- >> Create the snapshot. >> Exactly, create the snapshot for this moment in time. Let's go ahead and go to GitHub. >> So we're gonna go ahead, and we already have GitHub opened. And what you will want to do when you get into this GitHub screen is, you want to go into the top-right corner, and click on Create New, and New Repository. And usually the repository name you want it to be appropriate or somewhat related to your project. So for instance, since we named our Android project GitExample, we'll name it as such. You can put a description if you'd like, though it is not necessary. Lastly, you can choose whether or not you want this repository to be public or private. Since our account doesn't have any private rights, we're going to go ahead and click public and with that we can either initialize read me. And there are other options that you can do. And for our purposes, we are just going to click Create Repository from there. >> Exactly. All right, so now that we've created it. Now it's giving us a nice quick tutorial on what we should do to go ahead and add the code to our repository. So, the main one that we want to keep in mind is this one right here, want to grab that URL. Now essentially there is two ways you can do it, you can do it the command line way, or you can do it via Android Studio. So, Android Studio, if we go to VCS, Git, and Push, it'll say define a remote. So remote, it just stands for. >> The server, or the location of where we want to put our repository. >> Exactly. The name is gonna be Origin. That's the default remote name for git stuff. And then we just put in the URL here, press OK. All right, notice that our commit messages are here. And, basically, tracks changes that were made across our project. We're gonna go ahead and just hit Push at this point. All right, so we get an error down here, saying that it returned the 403. So I'm going to quickly go to the command line and just do some stuff. So we're gonna say git remote RM-origin. And now I'm going to do get remote add origin, paste the URL. I'm going to do git push origin master. All right, so, what's our username? >> IOT-410C. And what's our password? >> We can't tell you. >> Aw, come on. Oops, seems like we have an authentication issue. Let's try one more time. IOT-410C? -410c. All right, so now it will go ahead and upload it to GitHub. Let's go back here, and we just simply click the Refresh button. And there you go, now you have your files uploaded to GitHub. Notice that we can go ahead and view the files inside. So if we go inside of our source code, go to main, GitExample, we can look at our activity. We can go into our res files and see the specific change we made. Which is actually inside of our strings, that XML file. So you'll notice here there's a change you made. >> And essentially, GitHub will give you the folder breakdown and allow you to view the code from a browser. And with that, we have successfully started an application on Android Studio and connected it with our GitHub account. So in the future, now that we know that our remote repository works, and sometimes there are issues. You just kind of have to try over and over again. But essentially, what you want to do is, go to VCS, Git, and then to pull files, you're just gonna click the Pull button. And then to push your changes, you press the Push. And that should be it for the Git life cycle, and essentially using Git with Android studio. >> So stay tuned and we'll give you a summary and a look back at what we learned in this lesson.