Git Flashcards
What is version control?
Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
What are the benefits of a version control system?
You can:
revert files back to a previous state.
Revert the entire project back to a previous state,
Review changes made over time:
See who last modified something that might be causing a problem.
Who introduced an issue and when.
if you screw things up or lose files, you can generally recover easily.
What is git?
git is a version control system.
When working in a git project and you have broken your code what can you do to fix it?
You can revert back to when it wasn’t broken.
you can look to see which parts of the project have been changed.
What is a git repo and what is it short for?
A repo or repository is just a collection of files, which most likely contain your code.
What are the four fundamental areas in the git workflow?
Working Directory
Staging Area
Local Repository
Remote Repository
Consider a file in your Working Directory that you have made changes to, what three possible states can it be in?
It can be modified.
It can be staged.
It can be committed.
What does it mean when a file is staged?
It mean the file is marked to be committed to the local repository but is not yet committed.
What does it mean when a file is modified?
It means the file has been modified but the changes are yet to be stored in the local repository.
What does it mean when a file is committed?
It means that the changes you made to your file are safely stored in the local repository.
What does the command “git add” do?
“git add” is a command used to add modified files to the staging area. Modified files includes new files, modified files or deleted files.
What does the command “git commit” do?
git commit is a command used to add all files that are staged to the local repository.
What does the command “git push” do?
“git push” is a command used to add all committed files in the local repository to the remote repository. So in the remote repository, all files and changes will be visible to anyone with access to the remote repository.
What does the command “git fetch” do?
git fetch is a command used to get files from the remote repository to the local repository but not into the working directory.
What does the command “git pull” do? What is it equivalent to?
git pull is command used to get files from the remote repository directly into the working directory. It is equivalent to a “git fetch” and a “git merge” .
What command tells you the version of git you have installed?
“git –version”
What are SSH keys used for with git?
With SSH keys, you can connect to GitHub without supplying your username or password at each visit.
What command lets you view more information about a git command?
git help command
e.g.
git help add
This will open an information page in a browser.
Which command adds all new, deleted and modified files in the working directory to the staging area?
git add -A
What command shows you the files in the staging area?
git status
What command do you use to commit files to your local repo?
git commit -m “commit message goes here”
What command do you use to add a new remote repo? This will be a remote repo you push your local repo up to.
git remote add origin remote_repository_URL
git remote add origin https://github.com/ThomasAlexanderMann/react_challenge.git
What command lists the URLs of the remote connections you have to other repositories
git remote -v
What command pushes the changes in your local repository up to the remote repository you specified as the origin.
git push