Python for Entrepreneurs Transcripts
Chapter: Digging Further into Git
Lecture: Modifying files on GitHub
0:00 GitHub's user interface makes it easy to collaborate with other people,
0:03 by adding them to your public or private repository.
0:06 You can also handle issues through their interface
0:08 whether you are creating them or just responding to tickets.
0:11 There is another handy feature on GitHub that I sometimes use
0:14 especially when it comes to documentation.
0:16 And that is you can modify files directly on GitHub.
0:19 Your are unlikely to use this for any of your coding,
0:21 but, it can be handy if you need to make some tweaks to a README
0:23 or any other text files you've got in your repository.
0:26 I like to show this to people because if someone doesn't already have
0:29 Git and GitHub set up, they just need a GitHub account
0:32 and they can modify files directly through their web browser.
0:35 It lowers the barrier to entry in case you're working with somebody
0:37 who is a bit less technically savvy, let's take a look at how it works.
0:41 Let's edit a file directly in GitHub right now.
0:44 Click into a repository that you want to use.
0:46 In this case I am just going to use Full Stack Python
0:48 and when your repository comes up, as usual,
0:50 it will list all the files that are in your repository.
0:54 Now you can click into any of these files and I will show you the contents
0:57 and if you just want a copy and paste version, just a raw file, you can get that
1:02 just by clicking the "Raw" button on the user interface.
1:05 For this example, I am going to go back and take a look at the README
1:08 and modify the README directly.
1:11 So click into a file that you want to edit
1:13 right on GitHub, and then click the little pencil icon, edit this file.
1:17 This brings up the editor where you can modify the file
1:22 and also preview the changes, I'll just make a small edit,
1:26 I'll say "View all topics on the [table of contents page]", copy and paste URL,
1:37 and then it is on table-of-contents.html
1:43 Alright, let's say that is the change that I want to make,
1:45 and then we can commit the changes, they should look familiar,
1:47 this is the same as using the "git add" and "git commit" command
1:51 on the command line, we give it a title, that actually could be all that we specify
1:54 so we could just say "update README with link to table of contents",
2:00 but we can also add an extended description
2:02 just like when we used the "git commit" command and it opens up text editor
2:05 where we can add a longer description in addition to the title,
2:09 just a couple of reminders, you should have your title be less than 50 characters
2:13 anything longer than that really should be condensed
2:15 and then added to the extended description if you just can't quite fit it
2:19 into that 50 character limit, I'll add a quick description here,
2:22 and obviously for much larger commits you are going to want to have
2:26 a really detailed description of what exactly changed
2:29 and particularly why those files changed as opposed to "the what"
2:32 because "the what" would be captured in the diff
2:35 between the two commit versions, I'll add "the why" here and say
2:38 "Because the table of contents page has all topics, and the intro does not."
2:47 There are two options down here, we can commit directly to a branch,
2:50 in our course repository we've been using the master branch
2:53 and for many repositories people are just working on the master branch.
2:56 We can also create what is called a new branch and a pull request,
2:59 and if you are just working on the repository by yourself,
3:02 typically you are just going to commit directly to the branch.
3:04 And that is what we'll do here, OK, now our change is committed
3:07 and there is a new commit that was just created and we'll see it up in the corner here,
3:10 if we click on it, it's going to show us the diff between the old commit,
3:13 the second to latest commit and the absolute latest commit which was just created
3:18 if we flip back over into a README file, we can see the change that we've made here:
3:23 "View all topics on a table of contents page."
3:25 that is how you edit files directly on GitHub,
3:28 this can come in handy if you're working with someone
3:30 who doesn't have Git installed locally and they just want to edit
3:33 through the web UI or if you just want to make a few tweaks to your project
3:36 and don't have access to your local development environment.