Git interview Questions and Answer

Git interview Questions and Answer
Git interview Questions and Answer

Git interview Questions and Answer

What is Git? can you explain?

Ans- Git is a distributed version control is in the local machine make a copy of the repo. without internet, we can access the repository, in git every contributor has a local copy or clone of the main repository are stored in the local computer. 

What is a ‘Version Control System’?

Ans- A VCS is a system that records all changes made to a is the latest version of the file.

Differentiate between Git and GitHub?

Ans-GIT is a version control system for tracking files changes in is used to manage projects.

GITHUB-It is a git repository hosting service that provides a web-based graphical interface.

What do you mean by Git repository?

Ans- Git repository are which git files are stored in a local repository or remote repository

How to initialize a repository in Git?

Ans- to initialize repository in git you have to enter git init command, a hidden .git folder will appear

Name some Git commands with their function.

Ans- git add- It is used in the staging area to add one or more files

     git config- It configures the username and email address

     git init- Initialize empty git repository

     git commit-It commit the changes to head

What are the advantages of  Git?

Ans-faster release cycles

    pull request

    Easy collaboration

What language is used in Git?

Ans-C language is used in Git

What do you mean by commit message, and how is it executed?

Ans- The commit command is executed only after the files to be committed and added to the staging area using the git add command.

what are the popular Git hosting repositories?





what is the git push command?

Ans-It is used to push the content in a local repository to a remote repository

what is the git pull command?

Ans-It is a combination of two commands: git fetch and git merge. It fetches and merges the changes from the remote repository to the local repository.


Differentiate git fetch and git pull.

Ans-Git Fetch-: Git fetches only downloads new data from remote repository.

    Git Pull-: Git pull to update the current HEAD branch with the latest changes from the remote server by command -git pull origin master

What do you mean by merge conflict in Git?

Ans- A merge conflict occurs when git is unable to resolve the difference in code between the two commits automatically.

Can you resolve a merge conflict? if yes then how?

Ans- you have to open a file and make some changes after editing the file you can use the git add command to stage the new merged content, and after this create a new commit with the git commit command. Git creates a new merge commit.

How do you revert a commit?

Ans-git commit -m "commit message"

    git revert <commit id>


Explain about Git stash?

Ans- git stash modified tracked files and save them to the stack of unfinished changes that re-apply at any time.

what is git reset --mixed?

Ans- It is used to undo changes in the working directory and staging area

what is git merge --abort

Ans- It helps to stop the merge process.

Next Post »