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