Now that you have a GitHub repository set up, you're ready to learn how to use GitHub. In this lesson, you'll get some hands-on experience and become familiar with some of GitHub's main functionalities and features.
Working With GitHub
On the GitHub website, you have many options and functionalities available. Here's a list of things you can create, view, and access when working with GitHub:
Branches
Create a branch off the main project, so you can develop your work separately without impacting the main branch.
Issues
Create and discuss issues in the project.
Files
Create, upload, and search for files.
Forks
Create a copy of a repository, called a "Fork", to make changes without affecting the original. "Forking" is one of GitHub's flagship features. Forking helps people contribute to open-source projects, and also lets you create something new by starting with a mirror of the original project. You will learn more about this shortly!
Pull Requests
Create and manage Pull Requests for efficient collaboration.
Contributors
See exactly who made each edit to each line. Who's to credit, and who's to blame!
Contributions
See a visual representation of contributions charted over time.
Settings
Gain insights related to your repository, access a wiki, security settings, and much more.
Info: Lots of new terms? Don't worry! You'll learn about branches, forks, pull requests, and more in the upcoming lessons. You can also check out this great resource about Managing Your Work on GitHub.
How to Use GitHub Features in the Browser
Below are three convenient features of GitHub that you can use in your browser:
- Edit Files
- Create New Text Files
- View File Changes
All of the above are common actions that you can perform right through your browser instead of through using the command line. Next, we'll look closer at how you can achieve these actions on GitHub.
Edit GitHub Files in Your Browser
For any of your repositories, you can edit GitHub files in your browser using the built-in web editor. To give this a try, you'll use the repository named testing_git that you created earlier.
As a first experiment, you will edit the README.md file. Click on the file name to access it, then click on the little pencil icon towards the top right of the rendered README file:
Now add the following text into the editor:
# testing_git
This is a practice repository
## This is a big header
### This is a smaller header
[This is a link](https://codingnomads.com)
- These are bullet points
- These are bullet points
**This is markdown**
As a next step, you'll add a commit message. A commit message is a short description of what work you just did and that you are now adding to the repository. Remember that all your work is tracked and needs to be accounted for in an understandable manner. Finally, you click Commit changes. Keep all the default settings for now.
As you can see, the README file has been updated in your GitHub project and now contains the Markdown example syntax that you added further up:
Create New Text Files in GitHub
If you don't have a file to edit yet, you can also create new text files in GitHub using the browser. Go to the Add file dropdown menu and choose Create new file:
Next, you'll need to give the new file a name. You can call it hello-world.txt. Add some text to the new file using the built-in editor:
With the content done, you need to add a commit message next. Good commit messages are extremely useful as they can, like in this case, specify the file's purpose. Since you are practicing, write something like "Creating a file in GitHub" and commit the file:
Your newest file has been created in the repo. You can see the commit message you wrote next to your file name:
Note: The commit messages in the two previous screenshots are different from each other. This is only because the screenshots were taken for different commits. Otherwise, these messages should be the same.
Well done, you just created a file through GitHub's web interface! Next, check out one of GitHub's most common and powerful features by inspecting a graphical visualization of some file changes.
View File Changes in GitHub
To view the changes made to your file, start by editing the contents of hello-world.txt in the repo you've just created.
First, click on the hello-world.txt file name. Then, click on the pencil symbol in the top right corner of the file viewer. You'll notice you also have some other options here, such as deleting the file, as well as opening the file up using the new GitHub Desktop feature:
Make an edit to the file by changing the first line and adding a few more lines of text. No need to overthink the content; just add something like the example shown below:
Once you're done, click on Preview changes to see how the changes you made will affect the file once you save it:
You'll notice that this view shows lines that have been deleted or modified in red and new lines or updated lines in green. This is a great visual representation of file changes that makes it much easier to understand what changes have been applied in a commit.
You can confirm the change by adding a commit message and committing these edits to your GitHub project. Now, the edits have become part of your project's history.
You can always go back and see these edits, as well as any other commits, by clicking on Commits and selecting the one that shows the commit message you assigned to it.
Summary: How to Use GitHub
Throughout this lesson, you've seen some of the main features and functionalities you can utilize as you learn how to use GitHub. Here are some of the main things you can do when using GitHub:
- Branches
- Issues
- Files
- Forks
- Pull Requests
- Contributors
- Contributions
- Settings
How to Use GitHub in the Browser
You've also gained some real experience working with GitHub features, such as:
- Edit Files
- Create New Text Files
- View File Changes
With this lesson, you've come to the end of your high-level overview of Git & GitHub! In the next section, you will learn the different steps of a standard Git workflow. But first, a video demo on the main concepts for how to use GitHub. Ready, set...