Search Header Logo

Git And GitHub

Authored by Shashwat Mahendra

Computers

University

Used 5+ times

Git And GitHub
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which command does you use to clone the remote repository to his local machine?

git init
git clone <repository-url>
git push origin main
git commit -m "Clone repository"

Answer explanation

The command git clone <repository-url> is used to clone a remote repository to the local machine.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which command should you use to add a new file called index.html to the staging area?

git add index.html
git commit -m "Add index file"
git push origin main
git checkout index.html

Answer explanation

The command git add index.html stages the index.html file for the next commit.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Once the file is staged, which command does you run to save his changes with a message?

git commit -m "Added index.html"
git clone <repository-url>
git add index.html
git branch new-feature

Answer explanation

The command git commit -m "Added index.html" commits the changes with the provided message.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To create a new branch for the contact page, which command does you use?

git commit -m "Contact page"
git branch contact-page
git push origin contact-page
git merge contact-page

Answer explanation

The command git branch contact-page creates a new branch named "contact-page".

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

After finishing work on the contact-page branch, which command does you use to merge the branch back into the main branch?

git push origin main
git checkout contact-page
git commit -m "Merge contact-page"
git merge contact-page

Answer explanation

The command git merge contact-page merges the "contact-page" branch into the current branch.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Once the merge is complete, which command should you use to update the remote repository?

git pull origin main
git push origin main
git branch -d contact-page
git status

Answer explanation

The command git push origin main updates the remote repository with the merged changes.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

you wants to see a detailed history of commits on the main branch with each commit’s hash and message. Which command should he use?

git log --oneline
git status
git diff
git reflog

Answer explanation

The command git log --oneline shows the commit history in a concise format, including commit hashes and messages.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers