GIT Flashcards

1
Q

Git Project Layout

Working Directory: Space for Unmodified/modified files
To bring to Working Dir from GIT Dir need to CHECKOUT Project

Staging Area: Space for Staged Files
To go to STAGING AREA from WORKING DIRECTORY you STAGE files

GIT Directory
STAGING ===> GIT Directory is COMMIT Files

A

Working directory sometimes called the “working tree”

Staging Area sometimes called the “index”

git checkout updates files in wokring directory to match version in the index or specified

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

Git Project Layout

Working Directory: Space for Unmodified/modified files
To bring to Working Dir from GIT Dir need to CHECKOUT Project

Staging Area: Space for Staged Files
To go to STAGING AREA from WORKING DIRECTORY you STAGE files

GIT Directory
STAGING ===> GIT Directory is COMMIT Files

A

Working directory sometimes called the “working tree”

Staging Area sometimes called the “index”

git checkout updates files in wokring directory to match version in the index or specified

passing the git add command will add changes made to the files in staging area to the respository

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

GIT Status: Show the status of files in the directory

A

this checks the current status of the respository

it will report things like if there is nothing currently pending to be send to the repository or if there was a recent commit that looks like the current version of the code. Git status will display files with such changes because they are different from those in your most recent commit in your git repository.

Use git status to continue to monitor state between the repository and the working directory

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

git reset

A

resets the staging area, returning files to working tree

removes all files from the staging area

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

git rm

A

removes files from the workig directory and from being tracked

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

what is the difference between git and gitHub

A

git is a open-source tool for managing a repository. GitHub is a commercial entity that uses git.

Not required to use GitHub to use git

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

For updating local repository, what is the difference between git pull and git fetch

A

git fetch updates your local repository with all available remote branches

git pull performs a fetch and then merges the current branch into the appropriate remote branch

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

git checkout

this above command will transition a file called myfile.c from modeifed to unmodified without commiting it

A

command can be used ti discard changes

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

For updating local repository, what is the difference between git pull and git fetch

A

git fetch updates your local repository with all available remote branches

git pull performs a fetch and then merges the current branch into the appropriate remote branch

(git pull = git fetch + git merge)

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

To setup line ending preferences

A

git config –global core.autocrlf input

git config –global core.safecrlf true

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

Lab question: After staging changes with the “git add” command, what output do you see when checking the status of the working directory?

A

This means changes made have been temporarily staged but not recorded to the repository. The next commit operation will include staged changes

If at some point, user decides to not want to comitt that change, run GIT RESET command and it will unstage that change

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

What’s the point of staging files?

A separate staging step allows you to specify which modified files you actually want saved to your git repository, and which modified files you don’t want to save yet. It also allows you to bundle files as whole versions (so if you have 5 files staged that you commit, they are considered part of a single version).

A

By separate staging and committing, you have the ability to easily fine tune what goes into each commit

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

git commit

command to bundle up all the staged files, treat them as a single version, and save them into the git repository

A

the -m flag will allow to give a comment on the command line. commit command will allow you to interactively edit a comment for the commit

if -m is omitted from the command line, it will pop you in to the editor of choice so user can comment to the commit

default is VIM

ever file is given a hash to help track files

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

Most source control system work with files. Files are added to source control and the system will track changes to the file from that point on

Git focuses on the changes to a file rather than the file itself.

A

Running the ‘git add file’ command will have git make a note of the current state of the file to be committed later

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

git init

A

initialize repository

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

git add

A

add a file

17
Q

git commit

A

see waht has changed, creates snapshot of a file