Learning Version Control with GitHub: Part 3: Working with Repositories

Learning Version Control with GitHub


Working with Repositories

Repositories are collections of files. When changes are downloaded locally, they are pulled. Changes sent to the repository are pushed.

When a push is made, it is called a commit. This is a user “committing” their changes to the repository.

Commits

Screenshot 2018-10-02 11.45.26

On GitHub, all commits are given a unique identifiers. Each commit is tracked across the project and helps other contributors know that certain changes are associated with that user.

Pulling Updates

1 - GitHub Desktop - Fetch Pull

When using the GitHub Desktop application, one of the more common activities is to pull the latest changes. In the application, this is called fetch. Clicking it will download any changes to the repository made since last checked and will update the local files.

2 - GitHub Desktop - New File

Adding a file to the local folder will cause the GitHub Desktop application to update. It will show the latest changes and the textual content of those files.

3 - GitHub Desktop - Commits

Pushing Changes

All commits require a summary and an optional description. These help other users know why these changes were made and how they contribute to the overall project. Often, it is useful to write a longer description for multiple or larger changes to better help understand what is going on in the project and in regard to the changes.

4 - GitHub Desktop - Ready to Commit

Once the “Commit to master” button is clicked, the commit is ready to be pushed. The GitHub Desktop application will show at the bottom that a new commit as been created and is ready to be pushed. To do that, click on “Push origin” to upload those new changes.

Note: By default, all commits go the “master” branch of the project. Creating and using branches are part of a later section.

Screenshot 2018-10-02 12.24.26

Returning to GitHub in a web browser shows the new files (if any), the commit they are a part of, and when they were changed.

Screenshot 2018-10-02 12.26.27

Clicking on the name of a commit shows what was changed. As shown in the GitHub Desktop application, any additions (green) or deletions (red) will be shown.

Viewing Commits

Screenshot 2018-10-02 12.30.32

When viewing a repo on the GitHub website, one of the options is to view the commits made to that project.

Screenshot 2018-10-02 12.29.14

Clicking on “Commits” shows a listing of all changes during the lifetime of the project, who made then, when they were made, and what was changed.

While a pull is not tracked, all pushes and commits are tacked by GitHub and can be used to monitor a project, seeing who made which changes, when those changes were made, and how those changes affected the overall project.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s