Git Cheat Sheet: Essential Commands for Developers
11 Questions
0 Views

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

How can you view the list of modified files in Git history?

  • git log --grep='GUI'
  • git log --before='2020-08-17'
  • git log --stat (correct)
  • git log -3

Which command should you use to remove all untracked files in a Git repository?

  • git stash clear
  • git clean -fd (correct)
  • git branch bugfix
  • git checkout master

What is the Git command to tag the last commit as 'v1.0'?

  • git tag -d v1.0
  • git tag v1.0 (correct)
  • git tag v1.0 5e7a828
  • git tag

How do you show the author of each line in a specific file in Git?

<p>git blame file.txt (B)</p> Signup and view all the answers

Which Git command allows you to create a merge commit even if Fast Forward is possible?

<p>git merge --no-ff bugfix (A)</p> Signup and view all the answers

How can you view remote tracking branches in Git?

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

'git stash push -m 'New tax rules'' is used for what purpose in Git?

<p>Creating a new stash with a message (C)</p> Signup and view all the answers

'git bisect reset' is used for what purpose?

<p>Terminates the bisect session (B)</p> Signup and view all the answers

'git restore --source=HEAD~2 file.js' is used for what purpose?

<p>Restoring an earlier version of file.js from two commits ago (D)</p> Signup and view all the answers

Which Git command is used to apply the changes from a specific stash to the working directory?

<p>git stash apply 1 (B)</p> Signup and view all the answers

How can you delete all stashes in a Git repository?

<p>' git stash clear ' (B)</p> Signup and view all the answers

More Like This

Git Commands and Tagging Quiz
5 questions
Git Commands Basics
16 questions

Git Commands Basics

CharmingLorentz avatar
CharmingLorentz
Introduction to Version Control with Git
45 questions
Use Quizgecko on...
Browser
Browser