Git Cheat Sheet: Essential Git Commands for Developers
10 Questions
1 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

What command is used to remove all untracked files?

  • git cherry-pick dad47ed
  • git reset --hard HEAD^
  • git restore --source=HEAD~2
  • git clean -fd (correct)

Which command is used to view the history along with the list of modified files?

  • git log --stat (correct)
  • git log hash1..hash2
  • git log -3
  • git log --before=“2020-08-17”

How can you find the commits that touched a specific file?

  • git shortlog
  • git cherry-pick dad47ed
  • git blame file.txt (correct)
  • git log --pretty=format:”%an committed %H”

Which command is used to create and switch to a new branch?

<p>git switch -C bugfix (D)</p> Signup and view all the answers

What does 'git bisect' help in finding?

<p>Bad and good commits in a range (D)</p> Signup and view all the answers

Which command is used to delete all stashes?

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

What does 'git merge --no-ff' do?

<p>Creates a merge commit even if fast-forward is possible (C)</p> Signup and view all the answers

What does 'git rebase master' command do?

<p>Changes the base of the current branch to master (A)</p> Signup and view all the answers

'git push origin v1.0' is used for?

<p>'Pushing tag v1.0 to origin' (C)</p> Signup and view all the answers

'git remote rm upstream' is used for?

<p>'Removing remote upstream' (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