1 00:00:01,437 --> 00:00:04,807 [MUSIC] 2 00:00:04,807 --> 00:00:06,542 Hi, I'm Ben. 3 00:00:06,542 --> 00:00:10,485 In this workshop, we'll learn all about how to manage our GitHub projects, 4 00:00:10,485 --> 00:00:12,257 without leaving Android Studio. 5 00:00:12,257 --> 00:00:16,985 Also, since Android Studio is built on top of IntelliJ IDEA, most of this 6 00:00:16,985 --> 00:00:21,580 workshop should apply to IntelliJ IDEA for your Java projects as well. 7 00:00:22,850 --> 00:00:26,130 This workshop will assume that you already have a good understanding 8 00:00:26,130 --> 00:00:29,280 of the basics of Git and how to use GitHub. 9 00:00:29,280 --> 00:00:32,090 If you're not yet familiar with those, I encourage you 10 00:00:32,090 --> 00:00:34,920 to check out the Git basics course linked in the teacher's notes. 11 00:00:35,980 --> 00:00:40,170 We'll also tackle how to fix some typical Gradle build issues, so 12 00:00:40,170 --> 00:00:43,420 a little Gradle knowledge will be useful as well. 13 00:00:43,420 --> 00:00:45,090 The first thing that we're gonna go over, 14 00:00:45,090 --> 00:00:48,840 is how to send a project from Android Studio to GitHub. 15 00:00:48,840 --> 00:00:54,400 In order to do that, we'll need two things, a GitHub account and a project. 16 00:00:54,400 --> 00:00:57,518 Let's create a new project for this called GitHubTest and 17 00:00:57,518 --> 00:00:59,305 accept all the default options. 18 00:01:04,141 --> 00:01:07,285 Before we go on, let's quickly sync our project with Gradle. 19 00:01:09,290 --> 00:01:13,090 We want to include the module files and version control, but they haven't yet 20 00:01:13,090 --> 00:01:14,300 been created yet. 21 00:01:14,300 --> 00:01:16,850 Syncing the project will create them for us. 22 00:01:16,850 --> 00:01:19,890 That way, they'll be added to version control from the start and 23 00:01:19,890 --> 00:01:21,590 we won't have to add them later. 24 00:01:21,590 --> 00:01:24,910 Now that we have our project, we need to set it up with version control. 25 00:01:25,940 --> 00:01:28,350 Let's go to the VCS menu, which stands for 26 00:01:28,350 --> 00:01:33,400 version control systems, and select Enable Version Control Integration. 27 00:01:34,800 --> 00:01:37,360 Since we'll be pushing this project to GitHub, 28 00:01:37,360 --> 00:01:40,320 let's pick Git as the version control system and hit OK. 29 00:01:44,450 --> 00:01:49,350 We now have a local git repository located in our project's root folder. 30 00:01:49,350 --> 00:01:50,450 That's great, but 31 00:01:50,450 --> 00:01:54,440 we probably don't want to version control every file in our project. 32 00:01:54,440 --> 00:01:57,700 For example the build folder is recreated from source code 33 00:01:57,700 --> 00:01:59,380 any time we build the app. 34 00:01:59,380 --> 00:02:02,040 Since any contributors will just rebuild this, 35 00:02:02,040 --> 00:02:04,560 we don't need to include this in version control. 36 00:02:04,560 --> 00:02:08,670 Let's change to the project perspective and add an appropriate .gitignore file 37 00:02:08,670 --> 00:02:13,530 to tell Git which files and folders we don't want to include in version control. 38 00:02:13,530 --> 00:02:17,500 It looks like Android Studio has already created a .gitignore file for us. 39 00:02:17,500 --> 00:02:18,000 Let's open it. 40 00:02:19,040 --> 00:02:22,200 Awesome, we're already ignoring all the appropriate files. 41 00:02:22,200 --> 00:02:24,220 We can even see our build folder right here. 42 00:02:25,310 --> 00:02:27,060 It also looks like there's a plug-in, 43 00:02:27,060 --> 00:02:29,370 which can help us out with our .gitignore file. 44 00:02:29,370 --> 00:02:30,040 Let's check it out. 45 00:02:32,410 --> 00:02:34,690 Looks like it has some useful features. 46 00:02:34,690 --> 00:02:37,030 It would be nice if we could tell which files and 47 00:02:37,030 --> 00:02:39,270 folders are ignored just by their coloring. 48 00:02:39,270 --> 00:02:40,383 Let's go ahead and install it. 49 00:02:43,041 --> 00:02:47,069 We'll have to restart Android Studio to let the plug-in take effect. 50 00:02:47,069 --> 00:02:49,630 This plug-in definitely isn't required. 51 00:02:49,630 --> 00:02:51,874 So, if you don't want it, that's perfectly okay. 52 00:02:56,152 --> 00:02:58,480 Cool, now the ignored files are grayed out so 53 00:02:58,480 --> 00:03:02,410 we can easily distinguish them from the files included in version control. 54 00:03:03,420 --> 00:03:06,742 We also give an appropriate icon for our .gitignore file. 55 00:03:06,742 --> 00:03:09,066 We've created our local Git repository and 56 00:03:09,066 --> 00:03:12,468 we've verified that we have an appropriate .gitignore file. 57 00:03:12,468 --> 00:03:15,070 We are now ready to send our project to GitHub. 58 00:03:15,070 --> 00:03:18,737 Let's go back to the VCS menu, and select import, and 59 00:03:18,737 --> 00:03:22,495 into version control, and then Share Project On GitHub. 60 00:03:25,587 --> 00:03:28,259 Now we just login to our GitHub account. 61 00:03:32,118 --> 00:03:39,675 Give a name and a description for our project and click Share. 62 00:03:41,845 --> 00:03:44,475 This next dialogue lets us choose which files we would like 63 00:03:44,475 --> 00:03:46,550 to include in our initial commit. 64 00:03:46,550 --> 00:03:48,020 Just as we would expect, 65 00:03:48,020 --> 00:03:51,650 none of the files specified in our .gitignore are on this list. 66 00:03:51,650 --> 00:03:53,800 We're fine to leave them all checked and hit OK. 67 00:03:56,350 --> 00:03:58,500 Our project has now been showed on GitHub. 68 00:03:58,500 --> 00:04:01,110 We can click on the link on the top right to see our project. 69 00:04:04,300 --> 00:04:08,940 Remember, if you're using a free account this project is publicly available. 70 00:04:08,940 --> 00:04:11,190 In the next video we'll go over the workflow for 71 00:04:11,190 --> 00:04:13,000 making changes to an existing project.