Git is the most popular, open-source, widely used, and an example of distributed version control system (DVCS) used for handling the development of small and large projects in a more efficient and neat manner.
It is most suitable when there are multiple people working on projects as a team and is used for tracking the project changes and efficiently supports the collaboration of the development process.
With the help of the versioning system, the developer can identify who has made what changes and then run tests and fix bugs if any and then do necessary feature implementation. In case of any unforeseen circumstances, the code can be reverted to any of the previously working versions thereby saving huge efforts.
Scope of Git : Due to a well-established version control system and the support for collaborative work, git has garnered wide popularity not just amongst the software developers, but also among the people who do other tasks like documentation or any other collaborative work.
To prepare for advanced GIT examination , we need to have clear understanding of the basics and strong hold on the topics . Also most importantly practicing on those topics and questions level by level is also required. Below is a list of theory questions with line solutions or hints .
For basic level-
What is a version control system (VCS)? :A VCS keeps track of the contributions of the developers working as a team on the projects.
- What is a git repository? :A repository is a file structure where git stores all the project-based files. Git can either stores the files on the local or the remote repository
- What does git clone do? :The command creates a copy (or clone) of an existing git
- What does the command git config do. The git config command is used to set configuration options for defining the behavior of the repository, user information and preferences, git installation-based configurations, and many such things.
- Can you explain head in terms of git and also tell the number of heads that can be present in a repository? A head is nothing but a reference to the last commit object of a branch. For every repository, there will always be a default head referred to as “master” or now “main” but there is no restriction to the count of heads available.
- What is the functionality of git ls-tree? :This command returns a tree object representation of the current repository along with the mode and the name of each item and the SHA-1 value of the blob.
For Intermediate Level –
Why is it considered to be easy to work on Git? :With the help of git, developers have gained many advantages in terms of performing the development process faster and in a more efficient manner .
How will you create a git repository? :Have git installed in your system, then in order to create a git repository, create a folder for the project and then run git init.
Tell me something about git stash? : Git stash can be used in cases where we need to switch in between branches and at the same time not wanting to lose edits in the current branch
What differentiates between the commands git remote and git clone? : git remote command creates an entry in git config that specifies a name for a particular URL. Whereas git clone creates a new git repository by copying an existing one located at the URL.
- What does git stash apply command do? : git stash apply command is used for bringing the works back to the working directory from the stack where the changes were stashed using git stash command.
- Can you tell the difference between Git and GitHub? : Git version control system installed on local machines which allow developers to keep track of commit histories and supports collaborative work. Whereas GitHub is This is a cloud-based source code repository developed by using git.
- What is the difference between git stash apply vs git stash pop command? : Git stash pop command throws away the specified stash (topmost stash by default) after applying it. Git stash apply command leaves the stash in the stash list for future reuse. In case we wanted to remove it from the list, we can use the git stash drop command.
For Advanced Level –
What command helps us know the list of branches merged to master? : git branch –merged helps to get the list of the branches that have been merged into the current branch.
How will you resolve conflict in Git? :
Identify the files that have conflicts.
Discuss with members who have worked on the file and ensure that the required changes are done in the file.
Add these files to the staged section by using the git add command.
Commit these changes using the git commit command.
Finally, push the changes to the branch using the git.
What is the functionality of “git cherry-pick” command? : This command is used to introduce certain commits from one branch onto another branch within the repository .
What are the functionalities of git reset –mixed and git merge –abort? :
Git reset –mixed command is used for undoing changes of the working directory and the git index.
Git merge –abort command is used for stopping the merge process and returning back to the state before the merging occurred.
Can you tell the differences between git revert and git reset?:
Git revert: This command is used for creating a new commit that undoes the changes of the previous commit.
Git reset :This command is used for undoing the local changes done in the git repository
With the help of the above questions , that is you can answer these questions completely , it can be accepted that you have good understanding and with the help of such questions you can prepare for the advanced gits examination.