w1d6-w1d7 (Git) Flashcards
How can all files of a certain type be added to a commit?
Use a wildcard:
git add ‘*.txt’
What is the syntax to add a named repo?
git remote add repo_name repo_address
What does the -u flag do in the following command:
git push -u origin master
Tells git to remember the parameters for the push command, so ‘git push’ will suffice in the future.
What is the syntax to retrieve changes to a repo?
git pull reponame branchname
What does the following command do:
git diff HEAD
Assesses the difference between local files and the latest commit.
How can we assess the difference between staged files and the last commit?
git diff –staged
What is the command to unstage a file?
git reset filepath/filename
How can we revert a file to its state at the last commit?
git reset – filename
Explain the following command:
git rm ‘*.txt’
Removes all .txt files in the repo from the desk and the staging area.
What is the point of the -a flag in the git commit command?
Auto removes files that were removed from the disk but not the staging area when the next commit occurs.
What is a VCS?
A version control system; keeps track of different versions of files/projects.
What is a CVCS?
A centralized version control system; keeps track of files on a server which multiple users can access.
What is a DVCS?
A distributed version control system; versions are stored on a databases, and a user copies the entire repo everytime they access the files; prevents a single point of failure by ensuring that versions are distributed to multiple locations.
What makes Git so fast?
It stores all commits as a series of snapshots on the server, distributed to all local machines, so local machines have access the the entire repo and do not need to always go back up to the server.
What is the point of the checksum used to identify commits?
The checksum is based on the contents and directory structure at that time, so it is impossible to alter a file without Git knowing it.
What are the three sections of a Git project, and what are the differences between them?
The .git repository, where all commits are stored, the Staging Area, where files are added to when they are planned to be committed, and the Working Directory, which consists of files on the local machine.
What are the three states of a file in Git?
It can be committed, meaning a snapshot of the file in its current state has been taken, it can be modified, which means it is different than its last snapshot and is not being tracked, and staged, meaning it is different from its last snapshot and has been added to be committed.
What are the three ways for getting help for a git command?
$ git help
$ git –help
$ man git-