Intro to Git Flashcards

1
Q

Version

A

Code at a specific point in time labeled with a number based identifier. Synonyms: copy. How to Use in a Sentence: “I created a separate version of this file that updated previous version.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Version Control System

A

A tool that records changes to a file or set of files over time as versions. Synonyms: VCS. How to Use in a Sentence: “As a project grows, it’s wise to use a VCS to keep track of all its changes and progressions.”,”Good thing the VCS kept track of my previous commits, otherwise, I would have lost all that work!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Git

A

A distributed version control system that makes snapshots of files or multiple files in a repository to be later referenced as a version. How to use in a sentence: “The problem with git jokes is, everyone has their own version”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Repository

A

A directory that stores project files. Synonyms: Repo, folder, directory. How to use in a sentence: “The project is in a local repository on my machine.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Commit

A

An individual change to file(s), identified with a hash. How to use in a sentence: “The recent commit fixed the bug in our project”. A commit is a representation of a version of code at one point of time. We will build commits as we build software; we will create commits, and over time, these commits will represent different versions of code and build a history.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Git vs GitHub

A

Git is the name of the (distributed) version control system we will use. Git is a tool, and we’ll primarily use this tool in the command line or using an IDE. GitHub is a service that can host our codebases. GitHub’s hosting service is made for programmers who use Git in their projects. The primary way we interact with GitHub is through github.com.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How is Software Built as a History?

A

When we compare different versions of code to each other, we see how the code shrinks, grows, and changes between them. In a sense, version control systems let us understand that software is built over time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

$ git status

A

outputs a summary of the changes in : untracked, local, and staging areas. (If you’re ever in a weird space in git… try to run git status again - this will give tips on where you are at with staging, commits, etc)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

$ git diff

A

Will show a summary of all the changes in the local changes area. By default, it displays chunks to the diff. It names the file that the change is in, some of the surrounding lines, and a summary of lines of code that were added, removed or modified.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

$ git diff –staged

A

Reveals All Staged Changes. The command $ git diff –staged shows a summary of all changes in the staging area. It follows the same rules as $ git diff.
If there are a lot of staged changes, we’ll need to navigate the output using less commands. Use this command all the time:
*Before moving changes from the staging area to a commit
*Checking to see what’s in the staging area

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

$ git log

A

Reveals The Commit History. The command $ git log shows all of the commits made on this Git branch. Branches are covered in more detail in later lessons. For now, we can think of a branch as a sequence of commits within a repository. We will assume there is a single main branch, a single sequence of commits.
The log will clearly show the order of commits, and highlight their commit messages.
Each commit is listed with the following details:
The commit hash, which is a unique ID for the commit
The details on the branch that this commit is on
The author(s) of the commit
The date and time that the commit was made
The commit message

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

$ git show

A

Summarizes a Commit
The command $ git show will show the details of a single commit.

By default, $ git show prints this information:

    The commit hash (ID)
    The author(s)
    The date and time that the commit was made
    The commit message
    The entire diff of that commit

Without any arguments, $ git show will show the details of the most recent commit.
Optionally, we can give this command a commit hash, and it will show the details of that commit.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Commit Hashes Can Be Shortened

A

The commit IDs of Git are special. In general, each commit ID is very unique. They’re so unique, that using even the first several characters of it is enough to identify a commit. For example, anywhere that requires a commit hash, we can either use 06cde018c082dc4d936af278ba3b43ae5a3b9492, or 06cde01, and they would both work.

Being able to recognize this notation is important, as commit hashes are often shortened.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly