Git Basics

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is Git primarily used for?

  • Web development
  • Text editing
  • Database management
  • Version Control (correct)

What command initializes a new Git repository?

  • git start
  • git create
  • git init (correct)
  • git new

What does git add do?

  • Commits changes
  • Stages a file (correct)
  • Deletes a file
  • Creates a new branch

What command permanently records changes in Git?

<p>git commit -m &quot;message&quot; (B)</p> Signup and view all the answers

What does the command git commit -a -m "message" do

<p>It stages and commits all modified and deleted tracked files. (B)</p> Signup and view all the answers

What is the default name of the primary branch in Git?

<p>main (B)</p> Signup and view all the answers

What command lists all branches?

<p>git branch (A)</p> Signup and view all the answers

What command is used to switch branches?

<p>git checkout <branch> (D)</p> Signup and view all the answers

What command combines changes from one branch into another?

<p>git merge <branch> (B)</p> Signup and view all the answers

What command pushes changes to a remote repository?

<p>git push origin <branch> (A)</p> Signup and view all the answers

What command shows the commit history?

<p>git log (C)</p> Signup and view all the answers

What command downloads a repository from GitHub?

<p>git clone &lt;URL&gt; (D)</p> Signup and view all the answers

What command removes a file from staging?

<p>git reset <file> (C)</p> Signup and view all the answers

What command deletes a branch locally?

<p>git branch -d <branch> (C)</p> Signup and view all the answers

Which of the following statements about git pull and git fetch are correct?

<p>git fetch updates your local branch to match the remote branch but does not modify your working directory. (D)</p> Signup and view all the answers

Git is a centralized version control system.

<p>False (B)</p> Signup and view all the answers

git commit saves changes to the remote repository.

<p>False (B)</p> Signup and view all the answers

The command git push automatically merges remote changes into your local branch.

<p>False (B)</p> Signup and view all the answers

A repository must be cloned before you can push changes.

<p>False (B)</p> Signup and view all the answers

git merge is used to combine branches.

<p>True (A)</p> Signup and view all the answers

The command git remote add origin <URL> sets a remote repository.

<p>True (A)</p> Signup and view all the answers

The .gitignore file can prevent large files from being tracked.

<p>True (A)</p> Signup and view all the answers

Forking a repository creates a copy in your GitHub account.

<p>True (A)</p> Signup and view all the answers

Git allows multiple developers to collaborate on a single project.

<p>False (B)</p> Signup and view all the answers

The command git push automatically merges remote changes into your local branch.

<p>False (B)</p> Signup and view all the answers

The command ______ is used to check the status of the working directory.

<p>git status</p> Signup and view all the answers

To stage all modified files

<p>git add .</p> Signup and view all the answers

Downloads changes from the remote repository and updates the local branch.

<p>git pull origin main</p> Signup and view all the answers

To force delete a branch, use git branch -__ (branch-name)

<p>D</p> Signup and view all the answers

To safe delete a branch, use git branch -__ (branch-name)

<p>d</p> Signup and view all the answers

The .gitignore file prevents Git from _______ specific files.

<p>tracking</p> Signup and view all the answers

The command git commit -m "message" records changes to the ______.

<p>repository</p> Signup and view all the answers

The command git ____ displays the commit history.

<p>log</p> Signup and view all the answers

A local repository can be connected to a remote repository using ____ <URL>.

<p>git remote add origin</p> Signup and view all the answers

A new repository is initialized using.

<p>git init</p> Signup and view all the answers

Flashcards

Capital of France (example flashcard)

Paris

More Like This

Git Basics Quiz
10 questions
Git Basics Quiz
12 questions

Git Basics Quiz

EffortlessGiant avatar
EffortlessGiant
Git Basics for TYPO3 Integrators
40 questions
Git Basics and Workflow
16 questions
Use Quizgecko on...
Browser
Browser