Professional and Interview Questions on Git

Git is a repository contains a directory named .git, where git keeps all of its metadata for the repository.

  1. What is the command you can use to write a commit message?

We can use command :  “git commit –m “write some message” name of the repository/directory.

2. )      Is there any difference between GIT and SVN?

Yes we have some difference between GIT and SVN.

  1. a) Git is less preferred for handling extremely large files or frequently changing in the  binary files.
  2.  SVN can handle multiple projects stored in the same repository/directory.
  3. b) GIT does not support ‘commits’ across multiple branches or tags. Subversion allows the creation of folders/ Directories/at any location in the repository.

3) What are the advantages of using GIT?

  • Data redundancy and replication
  • High availability
  • Only one .git directory per repository
  • Superior disk utilization and network performance
  • Collaboration friendly
  • Any sort of projects can use GIT
  • What language is used in GIT?
  • Fast speed

4)  What is the function of ‘GIT PUSH’ in GIT?

What you have committed then it will need to update on the remote server ‘GIT PUSH’ updates remote server along with associated objects and branches.

“push Update remote refs along with associated objects”

5) What is “Staging Area” or “Index” in GIT?

Before completing the commits, it can be formatted and reviewed in an intermediate area known as ‘Staging Area’ or ‘Index’.

6) What is GIT stash?

In case if you are in the middle of something/task and need to jump over to the other job, and at the same time you don’t want to lose/destroy your current edits then you can use GIT stash.

7) How will you know in GIT if a branch has been already merged into master?

Git branch— the merged lists of all the branches that have been merged into the current branch.

Git branch—-no merged lists the branches that have not been merged, And it will not show any branch.

8) How to delete a Git branch both locally and remotely?

9) How we can remove local files (Not in Repo) from my current Git branch?

10) How to Checkout remote Git branch?

11) How you can  create a remote Git branch?

12)  How we can Change the URL for a remote Git repository?

13)  How to Change the author of a commit in Git?

14) What are the differences between ‘git pull’ and ‘git fetch’?

  • Git pull automatically merges the commits without letting you review them first.
  • Git fetch stores them in your local repository but it not merge them with your current branch.
  • git fetch similar to git pull but it does not merge the changes.

15) How to Edit an incorrect commit message in Git?

16) What is ‘git add’ is used for?

  • ‘git add’ adds file changes in your existing directory to your index.
  • ‘git add’ Add file contents to the index

17) What is the use of ‘git log’?

  • ‘git log’ Show commit logs
  • we can find specific commits in your project history / metadata repository – by author, date, content or history ‘git log’ is used.

18)  What is the function of ‘git rm’?

  • ‘git rm’ Remove files from the working tree and from the index.
  • we can remove the file from the staging area and also off your disk ‘git rm’ is used.

19)  What is the function of ‘git stash apply’?

If we want to continue working where you have left your work, ‘git stash apply’ command is used to bring back the saved changes onto the working directory/branch.

20) What is the difference between the ‘git diff ’and ‘git status’?

  • ‘git diff’ is very similar to ‘git status’, but it shows the differences between in the various commits and also between the working directory/branches and index.

21) What is the GIT client for LINUX

  •  Git GUI
  •  Git-g
  • Smart git
  • qGit
  •  Giggle
  • Git Cola

22) how to delete a branch ?

23)  What is another option for merging in git?

git merge, Join two or more development histories together
git rebase,  Reapply commits on top of another base tip

“Rebasing” is an alternative to merging the branch in git.


Post Author: Rohit

5 thoughts on “Professional and Interview Questions on Git

    Garfield Dewinne

    (August 24, 2017 - 9:38 pm)

    This design is wicked! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job. I really loved what you had to say, and more than that, how you presented it. Too cool!


      (August 26, 2017 - 8:04 am)

      Thanks for replying, ya sure we can work together.


      (August 28, 2017 - 4:45 pm)

      Thanks, please give me some suggestions and reviews about my Posts.


    (August 31, 2017 - 9:26 am)

    Do you have some good content about Jenkins and Basic Linux Videos?
    Because I don’t have so much experience on the linux platform…please suggest


      (August 31, 2017 - 10:15 am)

      yes, you can see the installation of jenkins on my website.

Leave a Reply

Your email address will not be published. Required fields are marked *