Part 1 - Staging and Committing

Fundamentals

git clone

First, clone this repository in your preferred way. Either use GitHub Desktop if you like a to visualize with an interactive window, or paste the URL after this command retrieved from clicking the green button that reads Code. No matter which option, you should only clone each repository once.

git add

Followed by the filename(s) you are adding to the repository. Notice this would add any igonore files by default. Need to specify your directory.

git commit

Use this for saving your progress/revisions.

The new commit is a direct child of HEAD, usually the tip of the current branch, and the branch is updated to point to it.

git commit documentation

Instructions

  1. After followingg the tutorial, compare the view of commit history in terminal versus in GitHub Desktop.
  2. Fork your own and upload files, relate Git commands to the data model.

Additional

  • CSE 373: use version control in IntelliJ and more in-depth explanation for committing/pushing/pulling
  • Git’s data model: this entire series covers tools seldomly introduced in CS classes, lecture 6 is specific on Version Control (Git)

Notes

  1. There is an exception for the quoted sentences in git commit, which is when no branch is associated with the working tree, in which case HEAD is “detached.”
  2. The commands can be followed by different options. Prefixed by -.
  3. If you have no previous experience with Git, it’s recommended to read the first few chapters in Pro Git.