Friday 7 August 2020

TOP 21 git interview question and answers for 2020 SET-02? SDET/Automation QA/Devops




Check GIT commands for Interview preparation SET-1:
GIT Interview Question 1 to 11

12. How to know about the history?

git log

To know more about git log : https://git-scm.com/docs/git-log

13. How to know all the details of changes to a commit?

git show <commitID>
To know more about git show : https://git-scm.com/docs/git-show
 
********************************************************

Framework Design Tips & Interview Question ==> Click Here

************************************************** 

14. How to know the last commit details and see a log where each commit is one line?

To know the last commit details : git log -1
see log each commit in one line: git log --pretty=oneline

15. What git add and git commit command does

Git add--> add the changes to index area
Git commit--> add changes to local repo

16. How to compare two branch in GIT?

git diff branch1...branch2


17. How to view current state and any merge conflits?

git status

The git status command displays the state of the working directory and the staging area.

18. How to undo last commit and rewrite history?

git reset --hard HEAD~1
 
 

19. Difference between soft, mixed, and hard resets?

--soft: Uncommit changes but leave those changes staged
--mixed (the default): Uncommit and unstage changes, but changes are left in the working directory
--hard: Uncommit, unstage, and delete changes

20.  How to reset a file back to how it was before changes?

git restore <filename>     # new syntax (as of Git 2.23)
git checkout -- <filename> # old syntax

21. How to unstage changes or restore files?

Maybe you accidentally staged some files which we don't want to commit.
git restore test.js
git restore .

#TodaysTip
Starting with git 2.23 we have new sub-commands :

1. git switch to switch between branches
2. git restore to undo all modifications made
Check GIT commands for Interview preparation SET-1:
GIT Commands SET-1

How to add repository in bitbucket for automation project and tracked by git? 
 
 Interview Question Set AutomationTesting/SDET/QAOPS
QA Job Opening: Click here

************************************************* 

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design 
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions


No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

Introduction to Web Testing with Playwright

  Introduction to Web Testing with Playwright 📌  Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 📌  YouTube channel:  https://lnkd.in/gGUG...