MCQs > IT & Programming > Git MCQs > Basic Git MCQs

Basic Git MCQ

1. After a recent release with a stack trace, an issue is create that indicates the problem is with a newly added configuration property named MaxConnections. What command can find all commits that add or remove the string MaxConnections?

Answer

Correct Answer: - git log -S "MaxConnections"

Note: This Question is unanswered, help us to find answer for this one

2. After staging changes to several files, you realize the changes to the confin.properties file are incorrect, and need to be removed from the stage and working directory. What command can you use to remove the staged changes to the file?

Answer

Correct Answer: Git rm config.properties

Note: This Question is unanswered, help us to find answer for this one

3. What statement best describes Git's concept of HEAD?

Answer

Correct Answer: A pointer to the most recent commit in the currently checked-out branch

Note: This Question is unanswered, help us to find answer for this one

4. After making some major changes to your code, you are a little nervous about committing. What command would you use to review the commit prior to making it?

Answer

Correct Answer: Git commit --dry-run

Note: This Question is unanswered, help us to find answer for this one

5. What is the difference between git stash pop and git stash apply?

Answer

Correct Answer: Git stash pop applies the topmost entry in the stash to the working files and removes it from the stash, while git stash apply applies the topmost entry in the stash to the working files but leaves it in the stash.

Note: This Question is unanswered, help us to find answer for this one

6. What type of Git hook could be used to validate that a commit message contains a ticket number?

Answer

Correct Answer: Commit-msg

Note: This Question is unanswered, help us to find answer for this one

7. What command takes changes from the master branch on the remote repository origin and merges them to the local checked-out branch?

Answer

Correct Answer: Git pull origin master

Note: This Question is unanswered, help us to find answer for this one

8. What are untracked files?

Answer

Correct Answer: Files in the working directory that Git does not know about because the have not been staged or committed

Note: This Question is unanswered, help us to find answer for this one

9. What command would you use to stage changes to the index strictly for properties files in the current directory?

Answer

Correct Answer: Git add *.properties

Note: This Question is unanswered, help us to find answer for this one

10. What is the staging area or index?

Answer

Correct Answer: An area that stores information about changes that will be included in the next commit

Note: This Question is unanswered, help us to find answer for this one

11. What does the -p option add to the output of the git log command?

Answer

Correct Answer: It adds patch output that shows a summary listing modified files.

Note: This Question is unanswered, help us to find answer for this one

12. What command takes changes from the master branch on the remote repository orgin and merges then to the local checked-out branch?

Answer

Correct Answer: Git pull origin master

Note: This Question is unanswered, help us to find answer for this one

13. When Git Workflows contain a long-running branch, what purpose does the long-running branch serve?

Answer

Correct Answer: Long-running branches correspond to different stages of development and are allways open for topic/feature branches to be pulled into.

Note: This Question is unanswered, help us to find answer for this one

14. What command finds the HEAD of the current branch?

Answer

Correct Answer: Git show-ref --head

Note: This Question is unanswered, help us to find answer for this one

15. What features do repository managers such as GitHub provide beyond Git?

Answer

Correct Answer: Repository managers provide an online service for hosting Git repositories that include collaboration features such as pull requests, issue tracking, and peer reviews.

Note: This Question is unanswered, help us to find answer for this one

16. How would you display a histogram showing inserts, deletion, and modifications per file for a specific commit along with its general commit information?

Answer

Correct Answer: Use git show --stat.

Note: This Question is unanswered, help us to find answer for this one

17. After accidentally deleting a branch in your local repository, how can you recover it?

Answer

Correct Answer: Find the hash of the branch with the reflog command, then execute git checkout -b .

Note: This Question is unanswered, help us to find answer for this one

18. After checking out a specific commit, you receive a warning message indicating You are in 'detached HEAD' state. What is Git warning you of?

Answer

Correct Answer: You are not working on the most recent commit of a branch.

Note: This Question is unanswered, help us to find answer for this one

19. How does the -p option change the behavior of the git add command

Answer

Correct Answer: It allows developers to interactively choose which changes to tracked files are staged and outputs the differences for review.

Note: This Question is unanswered, help us to find answer for this one

20. What is the default setting of git reflog when no subcommands are specified?

Answer

Correct Answer: Show

Note: This Question is unanswered, help us to find answer for this one

21. How would you delete a remote branch in your repository?

Answer

Correct Answer: Use git push --delete .

Note: This Question is unanswered, help us to find answer for this one

22. Which statement is true of the git push command?

Answer

Correct Answer: By default, a push doesn't send tags to the remote repository.

Note: This Question is unanswered, help us to find answer for this one

23. You stashed three sets of changes but cannot remember the contents of the first stash entry. What command would you use to see the details of the changes in the first of the three stash entries?

Answer

Correct Answer: Git stash show -p stash@{2}

Note: This Question is unanswered, help us to find answer for this one

24. What is the difference between git branch -d and git branch -D?

Answer

Correct Answer: -d deletes the local branch, while -D deletes the local branch regardless of push and merge status.

Note: This Question is unanswered, help us to find answer for this one

25. You would like to restore some previously stashed work to a new branch. How can you do that?

Answer

Correct Answer: Run git stash branch .

Note: This Question is unanswered, help us to find answer for this one

26. Your current repository has three branches: master, beta, and push-notifications. You have just finished the notification feature and commit the changes to the push-notification branch, and you want to include them in the beta branch. How can you accomplish this?

Answer

Correct Answer: Check out the beta branch and run git merge push-notifications.

Note: This Question is unanswered, help us to find answer for this one

27. What command displays the difference between the working tree and the stage/index area, as well as files not tracked by Git?

Answer

Correct Answer: Git status

Note: This Question is unanswered, help us to find answer for this one

28. What is the difference between git fetch and git pull

Answer

Correct Answer: Git fetch updates remote tracking branches with changes from a remote repository, while git pull updates remote tracking branches with changes from a remote repository and merges them into their corresponding local branches.

Note: This Question is unanswered, help us to find answer for this one

29. You have just completed rebasing your master branch and need to manually update the remote master, even though there is a merge conflict. How can you accomplish this?

Answer

Correct Answer: Git push --force-with-lease

Note: This Question is unanswered, help us to find answer for this one

30. What information do Git reflogs (reference logs) store?

Answer

Correct Answer: Updates to branch tips and other references in the local repository

Note: This Question is unanswered, help us to find answer for this one

31. After starting to work on a new feature and creating new files in the working directory related to it, the customer determined the feature was no longer required. What command can be used to remove the untracked files from the working directory ?

Answer

Correct Answer: Git clean -f

Note: This Question is unanswered, help us to find answer for this one

32. How would you configure Git to abort a commit if a smoke test script fails?

Answer

Correct Answer: Create a pre-commit hook to trigger the script.

Note: This Question is unanswered, help us to find answer for this one

33. Which command can be used to list the branches that have been merged into the currently checked-out branch?

Answer

Correct Answer: Git branch --merged

Note: This Question is unanswered, help us to find answer for this one

34. What is the difference between using the git stash and git stash pop commands?

Answer

Correct Answer: Git stash creates a stash entry, while git stash pop places the saved state onto the working directory.

Note: This Question is unanswered, help us to find answer for this one

35. What is version control?

Answer

Correct Answer: A system that shows, tracks, and controls changes to a set of files over time

Note: This Question is unanswered, help us to find answer for this one

36. What information does the git config file store?

Answer

Correct Answer: Local and global repository options

Note: This Question is unanswered, help us to find answer for this one

37. What is the difference between a soft reset (git reset --soft) and a hard reset (git reset –hard) ?

Answer

Correct Answer: A soft reset only changes the commit that HEAD points to, while a hard reset resets the index and working tree to match the specified commit, discarding any changes.

Note: This Question is unanswered, help us to find answer for this one

38. This command is an example of what kind of tag? git tag -a v1.4 -m "ABCD v1.5"

Answer

Correct Answer: Annotated

Note: This Question is unanswered, help us to find answer for this one

39. What is the difference between Git and SVN?

Answer

Correct Answer: SVN is a centralized system, while Git is a distributed system.

Note: This Question is unanswered, help us to find answer for this one

40. How does this command alter the currently checked-out branch? git reset --soft HEAD^

Answer

Correct Answer: It sets HEAD to previous commit and leaves changes from the undone commit in the stage/index.

Note: This Question is unanswered, help us to find answer for this one

41. What conflicts can occur when forcing a push after rebasing?

Answer

Correct Answer: The remote master branch could have existing changes overwritten.

Note: This Question is unanswered, help us to find answer for this one

42. How would you delete unreachable objects older than a specified time from your project database?

Answer

Correct Answer: Git prune --expire

Note: This Question is unanswered, help us to find answer for this one

43. Which option on the git log command allows you to limit output to commits made after certain date?

Answer

Correct Answer: --since

Note: This Question is unanswered, help us to find answer for this one

44. What Git workflow is used by teams that collaborate on a single branch and avoid creating long-lived development branches?

Answer

Correct Answer: Trunk-Based Development

Note: This Question is unanswered, help us to find answer for this one

45. What is the main issue with using git rebase when working with multiple developers?

Answer

Correct Answer: Rebase deletes all commit history for the new feature branch.

Note: This Question is unanswered, help us to find answer for this one

46. Which command correctly creates a lightweight tag?

Answer

Correct Answer: Git tag v3.8.1

Note: This Question is unanswered, help us to find answer for this one

47. If you have several commits for a single feature, what is the most efficient way to restructure your commit history?

Answer

Correct Answer: Use git squash to consolidate the commits together into a single coherent commit.

Note: This Question is unanswered, help us to find answer for this one

48. After starting to merge a feature branch into your master branch, you encounter a merge conflict and decide you do not want to perform the merge. How can you stop the merge and restore to the pre-merge state?

Answer

Correct Answer: Use git merge --abort.

Note: This Question is unanswered, help us to find answer for this one

49. After modifying some existing files in a repository, you decide to discard the changes. What command can you use?

Answer

Correct Answer: Git restore

Note: This Question is unanswered, help us to find answer for this one

50. What is a remote repository?

Answer

Correct Answer: A version of the repository hosted on the internet or network that is pushed to or pulled from by collaborators

Note: This Question is unanswered, help us to find answer for this one

51. You want to perform a git reset but cannot recall all of the available options. What command would you use to see a description of them?

Answer

Correct Answer: Git help reset

Note: This Question is unanswered, help us to find answer for this one

52. How does Git internally manage branches?

Answer

Correct Answer: By creating a pointer to the most recent snapshot/commit for the branch.

Note: This Question is unanswered, help us to find answer for this one

53. What happens if you run this command from your master branch? git checkout -b beta-test

Answer

Correct Answer: A new branch called beta-test will be created and switched to.

Note: This Question is unanswered, help us to find answer for this one

54. After mistakenly staging a file named myFile to the index, how would you remove it from the index to exclude it from your next commit?

Answer

Correct Answer: Use git reset myFile.txt.

Note: This Question is unanswered, help us to find answer for this one

55. What command creates a new branch from the currently checked-out branch?

Answer

Correct Answer: Git checkout -b

Note: This Question is unanswered, help us to find answer for this one

56. What does the git stash drop command do?

Answer

Correct Answer: Removes the most recent stash entry

Note: This Question is unanswered, help us to find answer for this one

57. After staging a series of changes to the index, which command could you use to review them prior to a commit?

Answer

Correct Answer: Git diff --cached

Note: This Question is unanswered, help us to find answer for this one

58. What types of tags does Git support?

Answer

Correct Answer: Lightweight and annotated

Note: This Question is unanswered, help us to find answer for this one

59. How many individual commits can a single repository have?

Answer

Correct Answer: Any number of commits

Note: This Question is unanswered, help us to find answer for this one

60. What is the difference between initializing a normal repo and a bare repo?

Answer

Correct Answer: Bare repos do not come with working or checked-out source files.

Note: This Question is unanswered, help us to find answer for this one

61. What is usually the extension of file which has the public key?

Answer

Correct Answer: Pub

Note: This Question is unanswered, help us to find answer for this one

62. What Language is used in GIT?

Answer

Correct Answer: C

Note: This Question is unanswered, help us to find answer for this one

63. What does refs store?

Answer

Correct Answer: SHA-1 value

Note: This Question is unanswered, help us to find answer for this one

64. Which strategy is used by Git for merging two branches?

Answer

Correct Answer: Recursive

Note: This Question is unanswered, help us to find answer for this one

65. Which version onwards did Git offer reversing a file back to what it looked like when last committed?

Answer

Correct Answer: 1.6

Note: This Question is unanswered, help us to find answer for this one

66. Which option enables inclusion of author name in custom log format?

Answer

Correct Answer: %an

Note: This Question is unanswered, help us to find answer for this one

67. How does Git think of its data?

Answer

Correct Answer: Snapshot

Note: This Question is unanswered, help us to find answer for this one

68. Which command gets a copy of an existing Git repository?

Answer

Correct Answer: Clone

Note: This Question is unanswered, help us to find answer for this one

69. Which of these terms best describes Git?

Answer

Correct Answer: Distributed Version Control System

Note: This Question is unanswered, help us to find answer for this one

70. Which key press returns a set of suggestions to pick from, when writing a Git command?

Answer

Correct Answer: Tab

Note: This Question is unanswered, help us to find answer for this one

71. Which of the following is called dumb protocol?

Answer

Correct Answer: HTTP

Note: This Question is unanswered, help us to find answer for this one

72. Which Git command begins tracking of a new file?

Answer

Correct Answer: Add

Note: This Question is unanswered, help us to find answer for this one

73. Which of the following is an integration manager?

Answer

Correct Answer: Benevolent dictator

Note: This Question is unanswered, help us to find answer for this one

74. Which command will list tags with the 1.4.2 series?

Answer

Correct Answer: Git tag -I 'v1.4.2.*'

Note: This Question is unanswered, help us to find answer for this one

75. Which user should be created first during setting up of SSH?

Answer

Correct Answer: Git

Note: This Question is unanswered, help us to find answer for this one

76. How many ways are present in Git to integrate changes from one branch into another?

Answer

Correct Answer: 2

Note: This Question is unanswered, help us to find answer for this one

77. What does commit object contain?

Answer

Correct Answer: An SHA1 name, a 40-character string that uniquely identifies the commit object.

Note: This Question is unanswered, help us to find answer for this one

78. Which setting determines what pager is used when Git pages output?

Answer

Correct Answer: Core.pager

Note: This Question is unanswered, help us to find answer for this one

79. While working on a feature branch you try to use "git rerere" to solve a recurring merge conflict but nothing is happening. What could be causing this issue?

Answer

Correct Answer: "rerere.enabled" isn't enable in the config file.

Note: This Question is unanswered, help us to find answer for this one

80. What command would you use to create a new git repository?

Answer

Correct Answer: Git init

Note: This Question is unanswered, help us to find answer for this one

81. While modifying a file, you're unexpectedly assigned an urgent bug fix on another branch. How can you temporarily save your local work without committing?

Answer

Correct Answer: Use git stash to save your work and come back later and reapply the stashed commit.

Note: This Question is unanswered, help us to find answer for this one

82. After you've successfully merged two branches and committed the changes, what is the next step in keeping your git structure organized?

Answer

Correct Answer: Run git rebase to move the current commit to its original location.

Note: This Question is unanswered, help us to find answer for this one

83. What change will the following command make to the staging area files? git rm --cached testfile.js

Answer

Correct Answer: Testfile.js will be removed from the staging area and its changes no longer tracked.

Note: This Question is unanswered, help us to find answer for this one

84. What command would let you modify your previous commit?

Answer

Correct Answer: --amend

Note: This Question is unanswered, help us to find answer for this one

85. How would you create a custom shortcut or command across your git environment?

Answer

Correct Answer: Create an alias usin the git config command.

Note: This Question is unanswered, help us to find answer for this one

86. After pushing commits to the remote repository for the first time using the command below, what shorthand command can you use in future? git push -u origin master

Answer

Correct Answer: Git push

Note: This Question is unanswered, help us to find answer for this one

87. Which of the following is true of the git push command?

Answer

Correct Answer: By default a push doesn't send tags to the remote repository.

Note: This Question is unanswered, help us to find answer for this one

88. In a situation where you have several commits for a single task, what is the most efficient way to restructure your commit history?

Answer

Correct Answer: Squash the related commits together into a single coherent commit.

Note: This Question is unanswered, help us to find answer for this one

89. What is the operation doing given the Git commands below? Git bisect start git bisect bad 5d41402abc4b2a76b9719d911017c592 git bisect good 69faab6268350295550de7d587bc323d

Answer

Correct Answer: It performs a binary search using a known bad commit and known good commit to determine which commit introduced a bug

Note: This Question is unanswered, help us to find answer for this one

90. Your team lead needs a list of all commits that will be moved before you perform a rebase. Which command can you use to access that information?

Answer

Correct Answer: Git rebase -i

Note: This Question is unanswered, help us to find answer for this one

91. You find that your project has a tag and branch both named push-notifications, which causes confusion when trying to print out given reference. How can you specify which branch you want to look at?

Answer

Correct Answer: Use git show refs/heads/push-notifications

Note: This Question is unanswered, help us to find answer for this one

92. Which statement is true when you use the git add -A command?

Answer

Correct Answer: All new and updated files from the working directory are staged to the index.

Note: This Question is unanswered, help us to find answer for this one

93. Where are files stored before they are committed to the local repository?

Answer

Correct Answer: Staging area

Note: This Question is unanswered, help us to find answer for this one

94. After you make changes to a local repository, you run the following command. What will this do? git commit -a -m "Refactor code base"

Answer

Correct Answer: Adds all modified files to the staging area, then commits them with a message

Note: This Question is unanswered, help us to find answer for this one

95. What files is this .gitignore programmed to leave out? #.swift; build/; *.txt; *.metadata;

Answer

Correct Answer: All files in the build directory, as well as files ending with .txt or .metadata

Note: This Question is unanswered, help us to find answer for this one

96. How can you display a list of files added or modified in a specific commit?

Answer

Correct Answer: Use the diff-tree command with the commit hash.

Note: This Question is unanswered, help us to find answer for this one

97. If you cloned an existing git repository, what would happen?

Answer

Correct Answer: A copy of the repository would be created on your local machine

Note: This Question is unanswered, help us to find answer for this one

98. How could you squash multiple commits together without using git merge --squash?

Answer

Correct Answer: Rebasing

Note: This Question is unanswered, help us to find answer for this one

99. What option can you use to apply git configurations across your entire git environment?

Answer

Correct Answer: --global

Note: This Question is unanswered, help us to find answer for this one

100. Why would you use a pre-receive hook in your remote repository?

Answer

Correct Answer: To execute a script when a remote receives a push that is triggered before any refs are updated

Note: This Question is unanswered, help us to find answer for this one

101. Why would the following command be used? Git rebase -i HEAD~10

Answer

Correct Answer: To run a comparative search of the last 10 commits for differences

Note: This Question is unanswered, help us to find answer for this one

102. You find a bug in your project, but can't locate where it was introduced in the commit history. How would you diagnose this problem?

Answer

Correct Answer: Use git bisect to compare the buggy commit to an early commit that works as expected.

Note: This Question is unanswered, help us to find answer for this one

103. What does the following command do to the git repository? git reset --soft HEAD^

Answer

Correct Answer: It sets HEAD to the previous commit and leaves changes from the undone commit in the stage/index.

Note: This Question is unanswered, help us to find answer for this one

104. Looking at the following commands, describe what is happening. git checkout feature-user-location; git cherry-pick kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231

Answer

Correct Answer: The commit is being cherry picked as the new HEAD of the commit history

Note: This Question is unanswered, help us to find answer for this one

105. What will the following command print to the Terminal? Git remote -v

Answer

Correct Answer: A list of remote repositories and their URLs

Note: This Question is unanswered, help us to find answer for this one

106. Which of the following is true you when you use the following command? git add -A

Answer

Correct Answer: All new and updated files are staged

Note: This Question is unanswered, help us to find answer for this one

107. Your current project has several branches; master, beta, and push-notifications. You've just finished the notification feature in the push-notification branch, and you want to commit it to beta branch. How can you accomplish this?

Answer

Correct Answer: Checkout the beta branch and run git merge push-notification

Note: This Question is unanswered, help us to find answer for this one

108. Describe what these Git commands do to the commit history: Git reset --hard HEAD~5 Git merge --squash HEAD@{1}

Answer

Correct Answer: The current branch's HEAD is reset back five commits, then prior commits are squashed into a single commit.

Note: This Question is unanswered, help us to find answer for this one

109. What command lets you create a connection between a local and remote repository?

Answer

Correct Answer: Git remote add new
Git remote add origin

Note: This question has more than 1 correct answers

Note: This Question is unanswered, help us to find answer for this one

110. How can you check your current git version?

Answer

Correct Answer: Git --version

Note: This Question is unanswered, help us to find answer for this one

111. What does git status -s do?

Answer

Correct Answer: It gives a short status report

Note: This Question is unanswered, help us to find answer for this one

112. Which initializes a new folder?

Answer

Correct Answer: git init

Note: This Question is unanswered, help us to find answer for this one

113. How can you create or switch to a new branch "feature"?

Answer

Correct Answer: git checkout -b feature

Note: This Question is unanswered, help us to find answer for this one

114. How do you keep track of remotes attached to a local repository?

Answer

Correct Answer: git remote

Note: This Question is unanswered, help us to find answer for this one

115. How to undo the last commit ?

Answer

Correct Answer: git rm classdir git add sourcedir

Note: This Question is unanswered, help us to find answer for this one

116. What is a hash function is used to identify git commits?

Answer

Correct Answer: SHA-1

Note: This Question is unanswered, help us to find answer for this one

117. Is it possible to define an alias for a git command?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

118. Is it possible to print git log using custom format?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

119. Which of the following commands will show the file changes before staging?

Answer

Correct Answer: git diff

Note: This Question is unanswered, help us to find answer for this one

120. How you can apply the changes introduced by some existing commits?

Answer

Correct Answer: git cherry-pick <commit>

Note: This Question is unanswered, help us to find answer for this one

121. The ' git log -1 --format="%h %an" ' command prints...

Answer

Correct Answer: Abbreviated commit hash and author's name

Note: This Question is unanswered, help us to find answer for this one

122. Is "request-pull" a built-in Git command?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

123. Which is the default merge strategy when pulling or merging one branch?

Answer

Correct Answer: recursive

Note: This Question is unanswered, help us to find answer for this one

124. How to switch between spaces and tabs in Windows ?

Answer

Correct Answer: git config --global filter.tabspace.smudge 'gunexpand --tabs=4 --first-only' git config --global filter.tabspace.clean 'gexpand --tabs=4 --initial'

Note: This Question is unanswered, help us to find answer for this one

125. What is the function of ‘GIT PUSH’ in GIT?

Answer

Correct Answer: ‘GIT PUSH’ updates remote refs along with associated objects.

Note: This Question is unanswered, help us to find answer for this one

126. What does git rerere command do?

Answer

Correct Answer: enables git to remember how a conflict was solved

Note: This Question is unanswered, help us to find answer for this one

127. Stash only one file out of multiple files that have changed with Git ?

Answer

Correct Answer: git stash --keep-index

Note: This Question is unanswered, help us to find answer for this one

128. The following command: `git mv -n foo.rb models/foo.rb` would:

Answer

Correct Answer: perform a dry-run, moving the file foo.rb to models/foo.rb

Note: This Question is unanswered, help us to find answer for this one

129. How to fetch all branches from default remote repository

Answer

Correct Answer: git fetch origin

Note: This Question is unanswered, help us to find answer for this one

130. What does the command `git add -A` do ?

Answer

Correct Answer: It stages all files in the entire working tree for commit

Note: This Question is unanswered, help us to find answer for this one

131. What does "git add ." do?

Answer

Correct Answer: Stages files in the current folder

Note: This Question is unanswered, help us to find answer for this one

132. Which command pushes the commits to the master branch in the origin remote

Answer

Correct Answer: git push origin master

Note: This Question is unanswered, help us to find answer for this one

133. Which command could be used to show what will be committed.

Answer

Correct Answer: git status

Note: This Question is unanswered, help us to find answer for this one

134. How do you remove a number of deleted file(s) at one go?

Answer

Correct Answer: git add -u

Note: This Question is unanswered, help us to find answer for this one

135. How do you delete files from local repository

Answer

Correct Answer: rm <filename>

Note: This Question is unanswered, help us to find answer for this one

136. Which abreviation is used to "checkout" command?

Answer

Correct Answer: git co

Note: This Question is unanswered, help us to find answer for this one

137. how do you move from branch to branch

Answer

Correct Answer: $git checkout <branchName>

Note: This Question is unanswered, help us to find answer for this one

138. how do you sync your remote repository with gitHub repository?

Answer

Correct Answer: $git pull origin <originName>

Note: This Question is unanswered, help us to find answer for this one

139. How can you bring a new feature in the main branch

Answer

Correct Answer: using the "git merge" command

Note: This Question is unanswered, help us to find answer for this one

140. Which command is used to create and move to a new branch

Answer

Correct Answer: git checkout -b <branchName>

Note: This Question is unanswered, help us to find answer for this one

141. How do you keep tract of remotes attached to a local repository?

Answer

Correct Answer: git remote

Note: This Question is unanswered, help us to find answer for this one

142. How do you create a local copy of a remote repository?

Answer

Correct Answer: git clone <remote repo url>

Note: This Question is unanswered, help us to find answer for this one

143. What is the function of "git clone"

Answer

Correct Answer: creates a copy of an existing git repository

Note: This Question is unanswered, help us to find answer for this one

144. What is "head" in git

Answer

Correct Answer: it is a reference to a commit object

Note: This Question is unanswered, help us to find answer for this one

145. which commande used to commit change

Answer

Correct Answer: git commit

Note: This Question is unanswered, help us to find answer for this one

146. which command used to initialise the repository

Answer

Correct Answer: git init

Note: This Question is unanswered, help us to find answer for this one

147. What is the git diff option to show the diffs of both staged and unstaged changes?

Answer

Correct Answer: HEAD

Note: This Question is unanswered, help us to find answer for this one

148. What does adding the -a option to git commit do?

Answer

Correct Answer: adds all changes from known files, removes all files in the index but not in the working tree, and performs a commit

Note: This Question is unanswered, help us to find answer for this one

149. Which command obtains the common parent of two commits?

Answer

Correct Answer: git merge-base <commit1> <commit2>

Note: This Question is unanswered, help us to find answer for this one

150. How is it possible to record a merge from branch "oldBranch" into master without modifying master content?

Answer

Correct Answer: git merge --strategy=ours oldBranch

Note: This Question is unanswered, help us to find answer for this one

151. What does the git commit option -s abbreviate?

Answer

Correct Answer: --signoff

Note: This Question is unanswered, help us to find answer for this one

152. Which command allows you to get the blob of some file whether it is in a repository or not?

Answer

Correct Answer: git hash-object

Note: This Question is unanswered, help us to find answer for this one

153. What git commit option is equivalent to using both the -F and -e options?

Answer

Correct Answer: -t

Note: This Question is unanswered, help us to find answer for this one

154. Which command will effectively preview a merge without making any changes?

Answer

Correct Answer: git diff ...<remote>/<branch>

Note: This Question is unanswered, help us to find answer for this one

155. What is the git diff option used to output the shortened diffs for a file foo.txt ?

Answer

Correct Answer: git diff --stat foo.txt

Note: This Question is unanswered, help us to find answer for this one

156. The command "git diff", without any additional arguments, shows...

Answer

Correct Answer: changes tracked by Git in the working directory that are not yet staged for the next commit.

Note: This Question is unanswered, help us to find answer for this one

157. What is the difference between the -c and -C options for git commit?

Answer

Correct Answer: -c invokes the editor while -C does not

Note: This Question is unanswered, help us to find answer for this one

158. What happens after you execute the following command? git tag -a

Answer

Correct Answer: Your system default editor will open.

Note: This Question is unanswered, help us to find answer for this one

159. Which git rebase mode allows you to combine commits by 'squashing'?

Answer

Correct Answer: Interactive

Note: This Question is unanswered, help us to find answer for this one

160. What is function of git clean -n

Answer

Correct Answer: Perform a “dry run” of git clean. This will show you which files are going to be removed without actually doing it.

Note: This Question is unanswered, help us to find answer for this one

161. True or false? "request-pull" a built-in Git command.

Answer

Correct Answer: True

Note: This Question is unanswered, help us to find answer for this one

162. Normally "HEAD" stores the name of a branch, and it is said to be detached when:

Answer

Correct Answer: it refers to an arbitrary commit that is not the tip of a branch.

Note: This Question is unanswered, help us to find answer for this one

163. You stage two files, f1 and f2. Which command unstages only f1?

Answer

Correct Answer: git reset HEAD -- f1

Note: This Question is unanswered, help us to find answer for this one

164. What does 'git diff other/master..HEAD' do

Answer

Correct Answer: checks the difference between your repo and another repo

Note: This Question is unanswered, help us to find answer for this one

165. What is the relationship between the --short and --dry-run options for git commit?

Answer

Correct Answer: using --short implies --dry-run

Note: This Question is unanswered, help us to find answer for this one

166. What is the common short-hand for deleting a branch in a remote repository?

Answer

Correct Answer: git push <repository> :<branch>

Note: This Question is unanswered, help us to find answer for this one

167. What does the git merge option -s abbreviate?

Answer

Correct Answer: --strategy

Note: This Question is unanswered, help us to find answer for this one

168. How do I merge changes made in "development" branch into "master" branch to avoid conflicts?

Answer

Correct Answer: git merge <development> from "master" branch

Note: This Question is unanswered, help us to find answer for this one

169. What is the git diff option to show the diffs of unstaged changes?

Answer

Correct Answer: no option necessary

Note: This Question is unanswered, help us to find answer for this one

170. What is the command to show the un-merged branches (local and/or remote) within the current branch?

Answer

Correct Answer: All of these

Note: This Question is unanswered, help us to find answer for this one

171. git mv is equivalent to what sequence of commands?

Answer

Correct Answer: git rm --cached old; mv old new; git add new

Note: This Question is unanswered, help us to find answer for this one

172. How do you set an existing local branch to track a remote branch?

Answer

Correct Answer: git branch --set-upstream localbranch remotebranch

Note: This Question is unanswered, help us to find answer for this one

173. What is the option to print a text-base graphic of the commit history when doing 'git log'?

Answer

Correct Answer: --graph

Note: This Question is unanswered, help us to find answer for this one

174. Which of these commands alters existing commits?

Answer

Correct Answer: rebase

Note: This Question is unanswered, help us to find answer for this one

175. Which command removes file foo.txt from the index but not from the working directory?

Answer

Correct Answer: git rm --cached foo.txt

Note: This Question is unanswered, help us to find answer for this one

176. Which command will move the changes from the last commit into in the stage area?

Answer

Correct Answer: git reset --soft HEAD^

Note: This Question is unanswered, help us to find answer for this one

177. Which command creates a new commit that undoes the changes in the most recent commit?

Answer

Correct Answer: git revert HEAD

Note: This Question is unanswered, help us to find answer for this one

178. A Git repo can consist how many number of heads

Answer

Correct Answer: Any number

Note: This Question is unanswered, help us to find answer for this one

179. Which is the command to remove everything from the stash?

Answer

Correct Answer: git stash clear

Note: This Question is unanswered, help us to find answer for this one

180. `git rebase <upstream>` will:

Answer

Correct Answer: Replay the changes made in the current branch on top of the changes made in <upstream> (as if the changes in the current branch had been done after the changes in <upstream>)

Note: This Question is unanswered, help us to find answer for this one

181. What is the "git status" option used to output the shortened project status?

Answer

Correct Answer: -s

Note: This Question is unanswered, help us to find answer for this one

182. Using which command you can apply a certain commit to the current branch, using the commit's SHA1?

Answer

Correct Answer: cherry-pick

Note: This Question is unanswered, help us to find answer for this one

183. Which command will show what revision and author last modified each line of a file?

Answer

Correct Answer: git blame

Note: This Question is unanswered, help us to find answer for this one

184. When pushing to a remote server, what is the only type of merge that is accepted by default?

Answer

Correct Answer: Fast-Forward

Note: This Question is unanswered, help us to find answer for this one

185. How do you add another git repository as a directory of your repository

Answer

Correct Answer: git submodule add <repository> <local directory>

Note: This Question is unanswered, help us to find answer for this one

186. What git feature allows you to embed separate repos?

Answer

Correct Answer: submodules

Note: This Question is unanswered, help us to find answer for this one

187. What's the purpose of 'git bisect' ?

Answer

Correct Answer: Find the commit which introduced a bug

Note: This Question is unanswered, help us to find answer for this one

188. How do you add only certain parts of a file to the index?

Answer

Correct Answer: git add -p

Note: This Question is unanswered, help us to find answer for this one

189. What option suppresses output for git rm?

Answer

Correct Answer: --quiet

Note: This Question is unanswered, help us to find answer for this one

190. Which of the following options enables helpful colorization of command line output?

Answer

Correct Answer: git config --global color.ui auto

Note: This Question is unanswered, help us to find answer for this one

191. True or False? Is Git a centralized version control system.

Answer

Correct Answer: False

Note: This Question is unanswered, help us to find answer for this one

192. What language is used in Git

Answer

Correct Answer: C

Note: This Question is unanswered, help us to find answer for this one

193. A staged file is

Answer

Correct Answer: A file added to the index

Note: This Question is unanswered, help us to find answer for this one

194. The command "git stash list" should print the following:

Answer

Correct Answer: All stashes currently on the stack

Note: This Question is unanswered, help us to find answer for this one

195. How to display a list of configuration parameters?

Answer

Correct Answer: git config -l

Note: This Question is unanswered, help us to find answer for this one

196. What command undoes all changes since the last commit?

Answer

Correct Answer: git reset

Note: This Question is unanswered, help us to find answer for this one

197. Which command deletes the branch named "stinky" regardless of merge status ?

Answer

Correct Answer: git branch -D stinky

Note: This Question is unanswered, help us to find answer for this one

198. Which one of the following commands lists REMOTE branches only?

Answer

Correct Answer: git branch -r

Note: This Question is unanswered, help us to find answer for this one

199. How do you stage all changes?

Answer

Correct Answer: git add .

Note: This Question is unanswered, help us to find answer for this one

200. How can I get the commit ID?

Answer

Correct Answer: git log

Note: This Question is unanswered, help us to find answer for this one

201. How do you undo all changes since your last commit?

Answer

Correct Answer: git reset --hard

Note: This Question is unanswered, help us to find answer for this one

202. Which command will restore the current branch and working copy to the exact state it was at before the most recent commit?

Answer

Correct Answer: git reset --hard HEAD^

Note: This Question is unanswered, help us to find answer for this one

203. What feature really makes GIT stand apart from nearly every other SCM

Answer

Correct Answer: Branching Model

Note: This Question is unanswered, help us to find answer for this one

204. You want to revert 'notes.txt' to the version in the most recent commit.

Answer

Correct Answer: git checkout -- /path/to/notes.txt

Note: This Question is unanswered, help us to find answer for this one

205. To limit the "git diff" comparison to the file foo.txt, use:

Answer

Correct Answer: git diff foo.txt

Note: This Question is unanswered, help us to find answer for this one

206. How do you retrieve changes from a remote repo?

Answer

Correct Answer: git pull origin master

Note: This Question is unanswered, help us to find answer for this one

207. What is the correct way to add multiple files to the staging area?

Answer

Correct Answer: git add file1.txt fil2.txt file3.txt

Note: This Question is unanswered, help us to find answer for this one

208. Which command shows you the version of your git installation.

Answer

Correct Answer: git --version

Note: This Question is unanswered, help us to find answer for this one

209. To update your local repo, which command will you use?

Answer

Correct Answer: git pull

Note: This Question is unanswered, help us to find answer for this one

210. How do you add all files in current directory to git repository?

Answer

Correct Answer: git add .

Note: This Question is unanswered, help us to find answer for this one

211. What is the command for viewing a list of recent commits?

Answer

Correct Answer: git log

Note: This Question is unanswered, help us to find answer for this one

212. How do you determine the current state of the project?

Answer

Correct Answer: $ git status

Note: This Question is unanswered, help us to find answer for this one

213. Is possible to have a global .gitignore file?

Answer

Correct Answer: Yes

Note: This Question is unanswered, help us to find answer for this one

214. CSS is also created and maintained by group of people within

Answer

Correct Answer: W3C

Note: This Question is unanswered, help us to find answer for this one

215. What does adding the -m option to git commit do?

Answer

Correct Answer: Uses the given message as the commit message

Note: This Question is unanswered, help us to find answer for this one

216. What is the command for displaying the version of git being used?

Answer

Correct Answer: git --version

Note: This Question is unanswered, help us to find answer for this one

217. How would one add Remote Repositories?

Answer

Correct Answer: git remote add [shortname] [url]

Note: This Question is unanswered, help us to find answer for this one

218. What is the main branch of a git repo commonly called?

Answer

Correct Answer: master

Note: This Question is unanswered, help us to find answer for this one

219. Which of the following is not a git command

Answer

Correct Answer: git moment

Note: This Question is unanswered, help us to find answer for this one

220. Which of the following is to copy a remote repository.

Answer

Correct Answer: git clone

Note: This Question is unanswered, help us to find answer for this one

221. What file is used inside of a repository, to list files that should be ignored by git?

Answer

Correct Answer: .gitignore

Note: This Question is unanswered, help us to find answer for this one

222. Which file in a git repository specifies intentionally untracked files that git should ignore?

Answer

Correct Answer: .gitignore

Note: This Question is unanswered, help us to find answer for this one

223. What shortcut creates and checks out a branch simultaneously?

Answer

Correct Answer: git checkout -b <branchname>

Note: This Question is unanswered, help us to find answer for this one

224. How do you add all the files in a subdirectory called ../project/experiment?

Answer

Correct Answer: git add ../project/experiment/*

Note: This Question is unanswered, help us to find answer for this one

225. What command creates a git repository in your current directory?

Answer

Correct Answer: git init

Note: This Question is unanswered, help us to find answer for this one