1 / 22

TOP 20 GIT INTERVIEW QUESTION FOR SDET

TOP GIT INTERVIEW QUESTION FOR SDET

Download Presentation

TOP 20 GIT INTERVIEW QUESTION FOR SDET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Top 20 GIT Interview Questions for SDET By DevLabs Alliance Visit us at: www.devlabsalliance.com Email: training@devlabsalliance.com Contact: +91 9717514555

  2. GIT Interview Questions for SDET 1. What does ‘hooks’ consists of in GIT? GIT hooks are Shell scripts that are executed before or after the corresponding GIT commands, such as : commit, push and receive. Git hooks are a built-in feature and there is no need to download them. For eg.: GIT will try to execute a post commit script after a run of commit.

  3. GIT Interview Questions for SDET 2. How can you fix a broken commit in GIT? git command --amend command is used to fix a broken commit in GIT. This command will fire the commit patch in $Editor. We just need to edit the message right on the top line of the file, save and then quit.

  4. GIT Interview Questions for SDET 3. What is conflict in GIT? A conflict in GIT arises when the commit that needs to be merged has some change in one file, and also the current commit has change in the same place in that file. In this case, GIT is not able to predict that which change should take precedence.

  5. GIT Interview Questions for SDET 4. What is ‘head’ in GIT and how many heads can be created in a repository? A ‘head’ in a GIT is simply a reference to a commit object. There is a default header referred as “Master” in every repository. A repository can contain any number of heads.

  6. GIT Interview Questions for SDET 5. What is another option for merging in GIT and what is the syntax for the same? ‘Rebasing’ is an alternative of merging in GIT. Syntax: git rebase [new-commit]

  7. GIT Interview Questions for SDET 6. What is ‘git add’ is used for in GIT? ‘git add’ is used to add file changes in working directory to staging area. It tells GIT that certain updates to a particular file needs to be included in the next commit. git add <file> : Stage all changes in the file for next commit. git add <directory> : Stage all changes in directory for the next commit.

  8. GIT Interview Questions for SDET 7. What is the use of ‘git log’ in GIT? ‘git log’ is used to find specific commits in project history. It can be searched by date, by author, by message, by file, etc. For eg.: git log --after=“yesterday” git log --author=”DLA”

  9. GIT Interview Questions for SDET 8. What is the use of ‘git reset’ in GIT? ‘git reset’ is used undo all the changes in the local directory as well as in the staging area and resets it to the state of last commit. Synatx: git reset

  10. GIT Interview Questions for SDET 9. What is GIT version control? GIT version control is used to track the history of a collection of files and it also includes the functionality to revert the collection of files to another version. Each version captures a screenshot of the file system at a certain point of time. All files and their complete history are stored in a repository.

  11. GIT Interview Questions for SDET 10. Mention some of the best graphical GIT client for LINUX. Some of the best GIT client for LINUX are: • • • • • • Smart Git Git Cola GIT GUI qGit Git-g Giggle

  12. GIT Interview Questions for SDET 11. What does commit object contain? Commit object contains the following: • • • It contains a set of files that represent the state of a project at a given point of time. It contains a reference to parent commit objects. Additionally, it contains an SHAI name, a 40 character string that uniquely identifies the commit object.

  13. GIT Interview Questions for SDET 12. What is Subgit and why subgit is used? SubGit is a tool that is used for a smooth , stress-free SVN to GIT migration. It is a solution for a company-wide migration from SVN to GIT. It is widely used for following reasons: • • • • It is much better than git-svn. There is no requirement to change the infrastructure that is already placed. It allows to use all features of GIT and SVN. It provides genuine stress-free migration experience.

  14. GIT Interview Questions for SDET 13. What is ‘git status’ used for? ‘git status’ is used to display the state of the working directory and the staging area. It allows us to see which changes have been staged, which have not been staged and which files aren’t being tracked by Git. Syntax: git status

  15. GIT Interview Questions for SDET 14. What is the function of ‘git stash apply’? ‘git stash apply’ command is used to bring back the saved changes onto the working directory. It is used when we want to continue working where we have left our work. Syntax: git stash apply

  16. GIT Interview Questions for SDET 15. How git instaweb is used? Git Instaweb automatically directs a web browser and runs webserver with an interface into your local repository.

  17. GIT Interview Questions for SDET 16. How do you squash last N commits into a single commit? Following command is used to squash the last N commits of the current branch: git rebase -i HEAD~{N} N= no. of commits that you want to squash. When the above command is run, an editor will open with a list of N commits message, one per line. Each of these lines begin with the word “pick”. Replacing the word “pick” with “squash” or “s” will tell Git to combine the commit with the commit before it. Hence set every commit in the list to be squash except the first one to combine all N commits into one.

  18. GIT Interview Questions for SDET 17. How can you copy a commit made in one branch to another? cherry-pick command is used to copy a commit from one branch to another. It allows to play back an existing commit to current location or branch. Simply switch to the target branch and call git cherry-pick {hash of that commit}.

  19. GIT Interview Questions for SDET 18. How do you cherry-pick a merge commit? cherry-pick uses a diff to find the differences between branches. Since merge commit belongs to a different branch, it has two parents and two changesets. For eg.: If we have merge commit ref 43ad64c, we have to specify -m and use parent 1 as base: git checkout release_branch git cherry-pick -m 1 43ad64c

  20. GIT Interview Questions for SDET 19. What is GIT Bisect and what is its purpose? Git Bisect allows to find a bad commits efficiently. Instead of checking every single commit to find the one that introduced some particular issue into the code, git bisect allows the user to perform a sort of binary search on the entire history of repository and hence making it easier to find a bad commit. This command uses a binary search algorithm to find which commit in the project’s history has introduced an issue. Before the introduction of issue, the commit is referred as ‘good’ and after the introduction of issue, it is referred as ‘bad’. Then this command picks a commit between those endpoints and asks what kind of commit it is. This process continues till it finds the exact commit that introduced the change.

  21. GIT Interview Questions for SDET 20. What commands will you use to bring a new feature to the main branch? To bring a new feature to the main branch, we can use git merge or git pull commands. Syntax: git merge git pull

  22. Visit us at: www.devlabsalliance.com Email: training@devlabsalliance.com Contact: +91 9717514555

More Related