Dev Environment Flashcards

1
Q

What is a command line?

A

A command line is a text-based environment where you can do things like create, move, copy, and delete files and folders, using different commands that are like mini-programs. Mac has a command line called Terminal.

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

What is Visual Studio Code?

A

Visual Studio Code is a text-editor used for writing code locally on your machine. It includes special features to make programming easier and will help you transition away from IDEs like repl.it to using a more professional workflow.

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

Which software is the most popular version control system to use today?

A

Git

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

What is GitHub?

A

GitHub is a service that allows you to save and share Git repositories (that is, projects where you’ve activated Git for version control) in the cloud. GitHub allows you and others to pull down code for a project from a central location, to make changes locally, and then push your changes back up to GitHub, where you can manage pull requests, which are a request to merge a set of changes into an existing code base.

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

Which command moves you from one directory (a.k.a., folder) to another in a forward manner?

A

cd (Change directory)

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

How do you make a file or folder hidden?

A

Use a period (.) as the first character in the file name.

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

Which command shows you the name of the folder you’re currently in on the screen?

A

pwd (Print working directory)

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

What command lists the contents of a directory?

A

ls (List files and folders)

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

What command creates a new directory?

A

mkdir (Make a directory)

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

What command creates a new (empty) file with a given name?

A

touch

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

What command removes a file (or folder)?

A

rm (Remove)

Be careful as this will permanently remove the file, making it difficult to recover.

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

What command can you use to remove a folder that isn’t empty?

A

rm -rf

The -r flag stands for recursive, and it’ll attempt to remove the subfolders within the target folder. The -f flag will automatically remove the files in the target folder and its subfolders without asking for confirmation.

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

What command can you use to remove a folder that isn’t empty while prompting you along the way to confirm the deletion of individual files?

A

rm -r

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

What command removes an empty directory?

A

rmdir (Remove directory)

Be careful as this will permanently remove the directory, making it difficult to recover!

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

What command renames a file or directory?

A

mv (Move)

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

What command copies a file or directory?

A

cp (copy)

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

What command shows the contents of a file on the screen?

A

cat (Concatenate)

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

What command on a Mac brings up the definition of the command?

A

man (Manual)

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

What command and flag can you use together to create create intermediate directories along the way to creating the target directory, if they don’t already exist?

A

mkdir -p

20
Q

What command can you use to go back to the parent directory?

A

cd ..

21
Q

What command can you use to take you to the same directory where you started in?

A

cd .

22
Q

What command can you use to take you to the grandparent directory of the one you’re currently in?

A

cd ../..

23
Q

What command and flag can you use to see files and folders that are hidden?

A

ls -a

24
Q

What command and flag can you use to help ensure you don’t accidentally delete a file or folder that you shouldn’t?

A

rm -i

or
rmdir -i

It’ll prompt you before you delete the file or folder, asking if you’re sure you want to delete them.

25
Q

What command initializes a new Git repository, and thus, creates a new master branch?

A

git init

26
Q

What command shows you the current state of the repository (a.k.a. “repo” for short)?

What is this command in Git? git status

A

git status

27
Q

What command stages new or changed files?

A

git add

28
Q

What command takes a snapshot of the repo at a point in time?

A

git commit

29
Q

What command shows what has changed in a repo since the last commit?

A

git diff followed by the path to the changed file:

git diff index.html

Remember, git diff will only show you the difference between the most recent commit and unstaged changes. Once your changes are staged, they won’t show up in the git diff.

30
Q

What two commands reset your repository to a prior state?

A

git reset followed by the SHA number or head:
git reset git reset 1234567890…..

or

git reset –hard followed by the SHA number or head:
git reset –hard Head~1

To find the SHA number, enter git log, find the SHA of the commit you want (the very long string of numbers). Then enter : q to quit out of the git log interface.

Then enter git reset and paste the SHA commit afterward like so:

git reset 1234567890…..

However, this is only a “soft” reset as it’ll remove them from your commit history but not from your file directory.

To remove the files from the file directory along with your commit history, add the –hard flag when you run git reset like so:

git reset –hard Head~1

31
Q

What command allows you to look at a prior state of the repository without rewriting your history in Git?

A

git checkout

To use this, enter:

git log

Find the SHA of the commit you want (the very long string of numbers). Then enter : q to quit out of the git log interface.

Then enter git checkout and paste the SHA commit afterward like so:

git checkout 1234567890…..

32
Q

What command gives you a list of all the commits (or snapshots) of your code that have been made?

A

git log

33
Q

How do you commit your changes in Git and add a comment about it?

A

Enter this into the command line:

git commit :i

After you hit Enter, you’ll be in the “insert” mode, which will allow you to edit the commit message.

Type your comment, and hit enter. Then press Esc and type :wq (which stands for write and quite) to save your commit message and exit out of the commit prompt.

34
Q

What command causes Git to stage any files that it’s already tracking but have unstaged changes?

A

git add -u

or

git add nameOfFile
ie. git add main.css

35
Q

What command allows you to supply a commit message inline with the git commit command?

A

git commit -m ‘your comment’

For example:
git commit -m ‘added content to files’

36
Q

What command allows you to see a high-level overview of the unstaged changes?

A

git diff –stat

37
Q

What command allows you to create a new branch?

A

git branch followed by the directory of what you want to create.

For example:
git branch feature/signup-form

Then switch to this branch by entering this:

git checkout followed by the name of the directory

For example:
git checkout feature/signup-form

38
Q

What command will merge changes from one branch into another?

A

git merge

39
Q

What command deletes a branch?

A

git branch -D followed by the name of the repository

For example:
git branch -D feature/signup-form

40
Q

How can you create a new branch and switch to it all at once?

A

git checkout -b followed by the new branch name.

For example:
git checkout -b feature/signup-form

41
Q

How do you merge your changes to the master branch?

A

Move into the master, and then merge from the branch. Enter this:

git checkout master

Then enter this:

git merge followed by the name of the repository

For example:
git merge feature/signup-form

42
Q

How can you see what commits have been merged to the master?

A

Use the –no-ff flag after git merge.

For example:
git merge –no-ff feature/signup-form

Then close the dialog by entering this:

:wq

Then enter this:

git log

And you’ll see the merge.

43
Q

What is a merge conflict?

A

A merge conflict is when you’re merging one branch into another, but the two branches have competing changes.

For example, while working on a new branch, your colleague is also working on their own branch and deployed their branch changes to the master branch before you deployed yours. Their branch changes made changes to the master branch. And some of those changes now conflict with the changes you made in your branch.

44
Q

How do you resolve a merge conflict?

A

Once you get the message in the Terminal that there is a merge conflict, open the text editor for your file and edit the code there. Save your changes, then stage the changes, and complete the merge commit. For example:

git add index.html
git commit

45
Q

What command allows you to push a local repository to GitHub?

A

git remote add origin https://github.com/mnx085/nameofrepository.git

Login to GitHub within your command, if necessary. Then enter this:

git push -u origin master

46
Q

How do you clone a GitHub repository to your local computer?

A

Go to the GitHub repository in GitHub, and click Clone or download. Copy the URL for HTTPS (or SSH if you have it setup).

Then in the command line, navigate to the folder you want to place the copy. Then enter this:

git clone URL

For example:
git clone https://github.com/Thinkful-Ed/shopping-list.git