Linkedin Git Assessment Cevapları

Soru 1: What command lets you create a connection between a local and remote repository?

  • git remote add new
  • git remote add origin
  • git remote new origin
  • git remote origin

Soru 2: How can you check your current git version?

  • git –v
  • git –option
  • git –version
  • git –current

Soru 3: Which of the following is true you when you use the following command?

git add -A
  • All new and updated files are staged
  • Files are staged in alphabetical order.
  • Only updated files are staged
  • All new files are staged

Soru 4: 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?

  • Checkout the beta branch and run git merge push-notification
  • Checkout the push-notifications branch and run git merge beta
  • Checkout the master branch and run git merge beta -> push-notification
  • Delete the push-notification branch and it will be committed to the master branch automatically

Soru 5: Describe what the following git commands do to the commit history.

git reset --hard HEAD~5
(Reset the current branch to the commit just before the last 5)
git merge --squash HEAD@{1}
(HEAD@{1} is where the branch was just before the previous command. This command sets the state of the index to be as it would just after a merge from that commit)
  • Reset the HEAD to the 5th commit in the repo, then merges to the master branch
  • Delete the last 5 commits
  • Reset the commit branch back before the last 5 commits, then squashes them into a single commit
  • Merges the last 5 commits into a new branch

Soru 6: What will the following command print to the Terminal?

git remote -v
  • A list of remote repositories you are connected to
  • The current git version you’re running
  • An inline editor for modifying remote repositories
  • The last 5 git versions you’ve installed

Soru 7: What does the following command do to the git repository?

git reset --soft HEAD^
  • Delete all previous commits and reset the repository history back to its initial state.
  • Resets the working branch to the first commit.
  • Undoes the last commit in the working branch and sets the HEAD back one commit.
  • Keeps the HEAD at the current commit, but clears all previous commits.

Soru 8: Looking at the following commands, describe what is happening.

git checkout feature-user-location
git cherry-pick {kj2342134sdf090093f0sdgasdf99sdfo992mmmf9921231}
  • The commit is being tagged for release on the feature-user-location-branch.
  • The commit is being cherry picked as the new HEAD of the commit history
  • A commit is being copied from its original branch over to the feature-user-location-branch
  • A commit is being copies from the feature-user-location branch to the master branch

Soru 9: 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?

  • Manually backtrack through your commit history.
  • Use git search -diff to compare all commits in your repository history.
  • Use git bisect to compare the buggy commit to an early commit that works as expected.
  • Run a git rebase to find the buggy commit.

Soru 10: Why would you use a pre-receive hook in your remote repository?

  • You wouldn’t, you would use it in the local repository
  • To execute a script when a remote receives a push that is triggered
    before any refs are updated
  • To fire a script after updates are made to the remote repository
  • To debug all commit tags and release versions

Soru 11: Why would the following command be used?

git rebase -i HEAD~10
  • To run a comparative search of the last 10 commits for differences
  • In order to locally cache the last 10 commits
  • To delete the last 10 commits and reset the HEAD
  • To list the last 10 commits and modify them with either the squash or fixup command

Soru 12: If you cloned an existing git repository, what would happen?

  • Nothing, cloning is not a supported git function
  • A new copy would overwrite the central repository
  • A copy of the repository would be created on the hosting platform
  • A copy of the repository would be created on your local machine

Soru 13: After checking your git status you get the following output, which shows the file beta-notes.js in the commit but also unstaged. How can this situation occur?

Change to be committed:

(use "git reset HEAD <file>..." to unstage)
modified: beta-notes.js
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout --<file>..." to discard changes in working directory)

modified: beta-notes.js
  • There were two copies of beta-notes.js but one was deleted.
  • Beta notes.js was staged, then modified afterwards, creating two different versions of the file
  • Two copies of beta-notes.js were created, but only one is being tracked
  • There are two tracked copies of beta-notes.js, but one was removed from the commit.

Soru 14: Where are files stored before they are committed to the local repository?

  • Saved files
  • git documents
  • git cache
  • Staging area

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

  • Cherry pick the related commits to another branch.
  • Squash the related commits together into a single coherent commit.
  • Delete the task commits and recommit with a new message.
  • Stash the related commits under a new hash.

Bonus: What commands would you use to force an overwrite of your local files with the master branch?

  • Option 1
git pull --all
git reset --hard origin/master
  • Option 2
git pull -u origin master
git reset --hard master
  • Option 3
git pull origin master
git reset --hard origin/myCurrentBranch
  • Option 4
git fetch --all
git reset --hard origin/master

Sistem Uzmanı, Linux Hacısı, El-Kernel

Yorum yapın