GitHub Interview Questions and Answers

Git is the most popular version control system (VCS)
First,.
What is version control system (VCS)?
A version Control System (VCS) is a category of tools that helps you and your team manage changes to the source code.
Git allows you to 
  • Make changes
  • keep history
  • view changes
  • Experiment without breaking the main code
What is GitHub?
GitHub basically a cloud based Git repository hosting service.

What is the use of GitHub?
Nowadays, lots of employers were asked to see your GitHub portfolio when you're interviewing for IT roles. GitHub portfolios give companies an idea of what projects you've worked on and what kind of
code you can write.

1. What is the command that downloads any repository from GitHub to your computer?

a. git push

b. git fork

c. git clone

d. git commit

Answer: c. git clone

2. How to push a file from your local system on to GitHub repository using Git?

First connect the local repository to your remote repository

git remote add origin {copied web address] —-> git remote add origin https://github.com/Simpililearn-github/test.git

Push your file to the remote repository

git push origin master

3. Which of the following CLI command can be used to rename files?

a. git rm

b. git mv

c. git rm -r

d. None of the above

Answer: b. git mv

4. What are the advantages of using a VCS (Version Control System)?

Produce flexibility
All the versions are easily available
Changes can be tracked easily
Provides backup

5. What is the difference between Git and GitHub?

GitHub is an American company that provides hosting for software development version using Git, It offers all of the distributed version control using Git. It offers all of the distributed version control source code management (SCM) functionality of Git as well as adding its own features.

6. Which language used in Git?

Git uses C language. GIT is fast, and C language makes this possibly by reducing the overhead of run times associated with high level language.

7. What is a commit message?

Command that is used to write a commit message is git commit <option> “message”

8. Explain some basic git commands?

git init
git status
git clone <url>
git add
git commit
git push origin master

9. What is subgit?

SubGit is a tool for SVN (SubVersion) to Git migration. It can create a writable git mirror of a local or remote subversion repository and use both subversion and Git as long as you like.

10.What’s the goal of the diff tool?

a. To keep track of changes to our files

b. To check if our changes make sense

c. To highlight new lines in Python files

d.To show the differences between two files

Answer: d. To show the differences between two files


Git commands

1. command for creating branch
    
      git branch branch_name

2. command for navigate between branches
      
    git checkout branch_name

    The git checkout command lets you navigate between the branches.

3. command for delete a branch

    git branch -d branch_name

                    or

    git branch -D branch_name

4. command for delete whole repository

    git rm -rf repository_name

5. command for merge a branch to master repository

    git merge branch_name


    

Comments