Saturday, 4 September 2021

Top 40 GIT Interview Questions and Answers for SDET - DevOps - Automation QA? Useful GIT commands to refer for daily DevOps Tasks?

 



Pipeline Script Fundamentals

Click Here :   DevOps Related Posts

 Check GIT commands for Interview preparation SET-1:

GIT Interview Question 1 to 11

Check GIT commands for Interview preparation SET-2:

GIT Interview Question 12 to 21

Check GIT commands for Interview preparation SET-3:

GIT Interview Question 21 to 30


What is GIT merge conflicts?

Merging and conflict are a common part of the Git experience. Conflicts in other version control tools like SVN can be costly and time-consuming. Git makes merging super easy. Most of the time, Git will figure out how to automatically integrate new changes.

Conflicts generally arise when two people have changed the same lines in a file, or if one developer deleted a file while another developer was modifying it. In these cases, Git cannot automatically determine what is correct. Conflicts only affect the developer conducting the merge, the rest of the team is unaware of the conflict. Git will mark the file as being conflicted and halt the merging process. It is then the developers' responsibility to resolve the conflict.

31. What is the use of Cherrypick in GIT?

It is used to apply one or more commit from one branch into your working branch or we can say Cherry picking is the act of picking a commit from a branch and applying it to another.

git cherry-pick <commit> <commit>


 How to integrate Maven project with Jenkins?

ANS: Maven & Jenkins Integration

32. How do I rename a branch in GIT while working on it?


You can use the below command for renaming of the branch:

git branch -m <new name>

Click Here :   DevOps Related Posts



33. If we want to rename the branch from outside the branch, then how can we do it?



git branch -m <old name> <new name>


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


Ans: Click Here For Answer


35. How do I create a new branch and apply Stash to it?


git stash branch <branch name> <stash_id>


36. The difference between rebase and merge?



    Ans: Click Here For Answer


37. How to view the contents of a Stash?



Ans: git stash show -p <stash_id>


38. How to undo commits?



Ans
: Click Here For Answer


39. How to track the remote branches in GIT?

Assuming there is a remote repository that you cloned your local repository from and also assuming that there is a branch named 'remote_branch' on that remote repository, here is how to track it locally:

# list remote branches
git branch -r

# start tracking one remote branch
git branch --track remote_branch origin/remote_branch


40.How to create repository in bitbucket and push code for automation project?

Ans: Click Here For The Steps
How to Push a local branch to a different remote branch:
Ans: git push origin <local_branch>:<remote_branch>
How to undo commits?

Ans: Click Here For Answer


Fetch changes from both origin and upstream in the same shot:


      Ans: git fetch --multiple origin upstream


How to Delete a remote branch on origin:


     Ans: git push origin :<remote_branch>

Difference between rebase and merge?


    Ans: Click Here For Answer


Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

TRAINING VIDEOS AVAILABLE with Live Doubt Session @4500/-(course-1 below,API Training Videos With ClassNotes and Coding Set) and 6500/- (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122


How to identify merge conflict

As we have experienced from the preceding example, Git will produce some descriptive output, letting us know that a CONFLICT has occured. We can gain further insight by running the git status command


The output from git status indicates that there are unmerged paths due to a conflict. The merge.text file now appears in a modified state. Let's examine the file and see whats modified.





Here we have used the cat command to put out the contents of the merge.txt file. We can see some strange new additions

  • <<<<<<< HEAD
  • =======
  • >>>>>>> new_branch_to_merge_later

Think of these new lines as "conflict dividers". The ======= line is the "center" of the conflict. All the content between the center and the <<<<<<< HEAD line is content that exists in the current branch main which the HEAD ref is pointing to. Alternatively all content between the center and >>>>>>> new_branch_to_merge_later is content that is present in our merging branch.

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

SeleniumWebdriver Automation Testing Interview Questions:

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

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

 

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


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

SeleniumWebdriver Automation Testing Interview Questions:

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

 
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


1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete

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...