Skip to content

Files

Latest commit

 

History

History

git_commit_and_sync

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jan 23, 2019

Git Commit and Sync

Before following these instructions, your HTML and CSS files should be completely finished and ready for grading. Save them and close them.

Up to now, you have done the following:

  1. Created a GitHub account and signed in.
  2. Forked and cloned a repo.
  3. Created a new branch named assignment-yourname and switched to that branch.
  4. Completed the assignment about CSS styles.

Commit and commit messages

Before you can synchronize your local files (local repo) with GitHub (remote repo), you must commit your changes. Git requires this.

A commit is often described as a snapshot. The snapshot records what has changed in this project since your last commit. The list of all commits is a record of all the changes made to the project since it began.

The commit message is your description or explanation of those changes. These messages can be very helpful in collaborative projects. They might be less meaningful for small, solo projects — but you have to write them anyway.

You can view all commits in a project (shown below in the GitHub Desktop app) and even revert to a previous version. The History tab in the app reveals your past commits.

History tab showing commits in GitHub Desktop

How to commit

A good commit message for this case would be: “Completed assignment files.”

In the Changes area of the app, bottom left, type your commit message in the box that says “Summary.” You don’t need a description. Click the button that says “Commit to assignment-yourname.” Note: assignment-yourname is the name of your branch. If this says “Commit to master,” you have not been working in the correct branch!

GitHub Desktop commit field

If you change anything in your files after this, you will need to commit again. Same procedure, but you should write a different message, such as “fixed color error” — describe what you changed.

How to sync, or push

Do this after you commit. You can make many commits, or one, before you push. In other words, you do not need to push every time you commit.

In the app, you'll find a “Push origin” button at the top. To push your changes up to GitHub.com, click the button. If the button says “Fetch origin,” you have not committed any changes.

Note: If you have not published this branch yet, the button will say “Publish branch,” not “Push origin.” Click that.

By pushing, you make your remote repo (at GitHub) match your local repo (on your hard drive), providing a backup for your work. By keeping local and remote repos synchronized, you can protect your work and also share it with other people.

Look at your repo on github.com and check to see that your files are there, in the assignment-yourname branch, in the assignment folder.

Check the rubric

Make sure you have done everything listed in the rubric.

If so, submit the complete URL of your GitHub repo in Canvas.

If you need to change anything in your files: After changing and saving them in your text editor, re-follow the steps on this page to commit again and push.

If you do not push, I will NOT see your changes.