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.
Instructions
- After followingg the tutorial, compare the view of commit history in terminal versus in GitHub Desktop.
- Fork your own and upload files, relate Git commands to the data model.
Additional
Links
- 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
- 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.” - The commands can be followed by different options. Prefixed by
-
. - If you have no previous experience with Git, it’s recommended to read the first few chapters in Pro Git.