Advanced Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Git Set Up

  1. Set a Git username.
  2. Confirm that you have set the Git username correctly.
A

git config –global user.name “Mona Lisa”

git config –global user.name

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

Git Set Up (2)

  1. Set an email address in Git.
  2. Confirm that you have set the email address correctly in Git.
  3. Change the email associated with commits you make in a single repository. Overriding global Git config settings in this one repository, but won’t affect any other repositories.
A

git config –global user.email “example@gmail.com”

git config –global user.email

git config user.email “new_example@gmail.com”

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

Generate a new SSH key for Git with Git Bash.

A

ssh-keygen -t rsa -b 4096 -C “your_email@gmail.com”

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

Add your SSH key to the ssh-agent with Git Bash.

  1. Ensure the ssh-agent is running.
  2. Add your SSH private key to the ssh-agent.
  3. Copy the SSH key to your clipboard.
A

eval $(ssh-agent -s)

ssh-add ~/.ssh/id_rsa

clip < ~/.ssh/id_rsa.pub

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

Initialize a Git repository.

  1. Make a new directory to practice and enter it.
  2. Turn the current, empty directory into a fresh Git repository.
  3. Create a new README file with some sample text.
  4. Add the new file to the Git staging area.
  5. Make your first commit with the new README file.
A
  1. mkdir git_practice & cd git_practice
  2. git init
  3. echo “Hello Git and GitHub”&raquo_space; README.txt
  4. git add README.txt
  5. git commit -m “First commit”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Add your local repository to the remote GitHub repository.

And push the first commit.

A

git remote add origin git@github.com:/git_practice.git

git push -u origin master

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
  1. Delete the most recent commit, keeping the work you’ve done:
  2. Delete the most recent commit, destroying the work you’ve done:
A

1.
git reset –soft HEAD~1

2.
git reset –hard HEAD~1

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

In order to get your own replica of a remote GIT site, clone this site to a local location.

A

git clone remote_location clone_name

  • remote_location tells Git where to go to find the remote. This could be a web address or a filepath.
  • clone_name is the name you give to the new directory in which Git will clone the repository.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Enter in terminal the command to list the remotes - the name of the remote, origin, as well as its location.

*You must cd in the corresponding directory.

A

git remote -v

*Git automatically names this remote origin, because it refers to the remote repository of origin. However, it is possible to safely change its name.

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

Check if changes have been made to the remote and bring the changes down to your local copy.

A

git fetch

*This command will not merge changes from the remote into your local repository. It brings those changes onto what’s called a remote branch.

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

Switch to your master branch and merge with origin/master, - the remote site where the most recent commits are.

A

git checkout master

git merge origin/master

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

Push your new branch up to the remote, origin, where it can be reviewed and merged into the master branch, making it part of the definitive project version.

A

git push origin YOUR_NEW_BRANCH

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

Define the Git Collaborative Workflow for working with a remote branch.

A

Git Collaborative Workflow:

After the origin/master has been merged into the local master branch, the local branch is ready to be worked on. The workflow for Git collaborations typically follows this order:

  1. Fetch and merge changes from the remote
  2. Create a branch to work on a new project feature
  3. Develop the feature on your branch and commit your work
  4. Fetch and merge from the remote again (in case new commits were made while you were working)
  5. Push your branch up to the remote for review
    * Steps 1 and 4 are a safeguard against merge conflicts, which occur when two branches contain file changes that cannot be merged with the git merge command.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly