0% found this document useful (0 votes)
45 views4 pages

Git Mock

Git is a version control system that allows tracking changes to files. It is decentralized, allowing offline work. GitHub is a hosting service for Git repositories that provides additional collaboration tools. A Git repository stores files and their change history. Version control systems track changes to prevent loss of information and easy reverting. Compared to centralized SVN, Git allows offline work and branching.

Uploaded by

TEJAS KHARTODE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views4 pages

Git Mock

Git is a version control system that allows tracking changes to files. It is decentralized, allowing offline work. GitHub is a hosting service for Git repositories that provides additional collaboration tools. A Git repository stores files and their change history. Version control systems track changes to prevent loss of information and easy reverting. Compared to centralized SVN, Git allows offline work and branching.

Uploaded by

TEJAS KHARTODE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Git Mock

1. What are Git and GitHub?

Git is a version control system that allows you to track changes made to a project or file over time.
GitHub is a platform that hosts Git repositories, allowing users to share and collaborate on their
projects with others.

2. What is the difference between Git and GitHub?

Git is a version control system while GitHub is a hosting service for Git repositories. GitHub provides
additional features like bug tracking, project management, and collaboration tools that make it easier
to work with Git repositories.

3. What is a Git repository? Name some popular Git hosting services.

A Git repository is a collection of files and the entire history of changes made to those files. Some
popular Git hosting services include GitHub, GitLab, and Bitbucket.

4. What is a version control system? Mention its types.


A version control system is a tool that helps you manage changes made to a project or file over time.
It keeps track of every change and allows you to revert back to a previous version if needed. There
are two types of version control systems: centralized and decentralized.

5. What are the main differences between Git and SVN?


Git is a decentralized version control system, meaning that every copy of the repository is a full
version of the project. SVN (Subversion) is a centralized version control system, meaning that there is
only one main repository and all changes must be made to it. Another difference is that Git allows for
offline work and branching, while SVN does not.

6. What are the advantages of using GIT?

Some of the advantages of using Git include: easy collaboration and sharing of code, version control
and tracking of changes, ability to revert back to previous versions, and the ability to work offline.

7. What language is used in GIT?

Git is written in the programming language C.

8. What are the advantages of Git over SVN?


The advantages of Git over SVN include: better performance, support for distributed work, and
easier branching and merging. Git also has a more robust system for tracking changes, making it
easier to revert back to previous versions.

9. What is Git Bash?

Git Bash is a shell for Windows that provides Git command line tools for use in a Unix-style
environment. It allows you to interact with Git repositories and perform various Git operations.

10. What is the meaning of “Index” or “Staging Area” in GIT?


The index, also known as the staging area, is a temporary holding area where changes are stored
before they are committed to the Git repository. It allows you to review and organize the changes
before finalizing them. The index is used to ensure that only the desired changes are included in the
commit and that the commit is organized and meaningful.

11. What is tagging in Git?

Tagging in Git is a way to label a specific point in the Git history of a project or repository. It is used to
mark important releases or milestones, allowing you to easily refer back to those points in time.

12. What is forking in Git?

Forking in Git is the process of creating a copy of an existing repository in your own GitHub account.
This allows you to make changes to the code without affecting the original repository, and you can
also contribute your changes back to the original repository if desired.

13. What is the use of a Git clone?

The purpose of a Git clone is to create a local copy of a remote repository on your computer. This
allows you to work with the code and make changes, and then push those changes back to the
remote repository when you are ready.

14. What is the function of ‘git config’?

The 'git config' command is used to set up the configuration settings for Git on your local machine.
This includes setting up your username and email, as well as other settings like the default editor and
the remote repository location.

15. What is the process for creating a repository in Git?

To create a repository in Git, you need to go to the GitHub website and create a new repository. Once
you have created the repository, you can use the 'git clone' command to clone it to your local
machine. From there, you can add files, make changes, and push those changes back to the remote
repository. You can also use the 'git init' command to create a new repository locally on your
machine, but it will not be hosted on GitHub unless you create a new repository on the website and
then push your local repository to it.

16. What is cherry-pick in Git?


The cherry-pick in Git is a command that allows you to select specific changes from one branch and
apply them to another branch. This can be useful if you want to apply changes made in one branch
to another branch, but do not want to merge the entire branch.

17. What is origin in Git?

In Git, the term "origin" refers to the default remote repository that is associated with your local
repository. This is typically the repository where you cloned the code from, and it is used as the
default location for pushing and pulling changes.

18. What is the git push command?

The 'git push' command is used to push changes from your local repository to the remote repository.
This allows you to share your changes with others and collaborate on the code.

19. What is the git pull command?


The 'git pull' command is used to retrieve changes from the remote repository and merge them into
your local repository. This can be used to keep your local repository up-to-date with the latest
changes made by others.

20. What is the difference between git fetch and git pull?

The difference between 'git fetch' and 'git pull' is that 'git fetch' only retrieves changes from the
remote repository, but does not merge them into your local repository. 'Git pull' retrieves the
changes and automatically merges them into your local repository. 'Git fetch' is useful if you want to
review the changes before merging them, while 'git pull' is useful if you want to automatically keep
your local repository up-to-date.

21. Explain git checkout in Git.

The 'git checkout' command in Git is used to switch between different branches in a repository, or to
restore files to a specific version. You can use 'git checkout' to switch to a different branch, to see the
changes in a particular version, or to recover files that were accidentally deleted.

22. What does git rebase do?


'Git rebase' is a command that is used to reapply changes from one branch to another branch. This
can be useful if you want to keep your branch up-to-date with changes made in another branch, or if
you want to reorganize the history of a branch to make it easier to understand.

23. What is the difference between git rebase and git merge?

The difference between 'git rebase' and 'git merge' is that 'git rebase' reapplies changes from one
branch to another branch, while 'git merge' combines two branches into a single branch. 'Git rebase'
can lead to a cleaner history, but it can also cause conflicts if the same lines of code have been
changed in both branches. 'Git merge' is a simpler option that creates a new merge commit that
combines the changes from both branches.

24. What is revert in Git?


'Revert' in Git is a command that allows you to undo changes that have been made to a repository.
You can use 'git revert' to undo a specific commit, or to undo a series of commits. This is useful if you
want to undo changes that have been made by mistake or if you want to go back to a previous
version of the code.

25. What is the difference between resetting and reverting?

The difference between resetting and reverting is that 'reset' discards changes made to the
repository, while 'revert' undoes changes that have been made. 'Reset' is a more powerful command
that can completely erase changes that have been made, while 'revert' only undoes the changes and
leaves a record of the changes that were undone. 'Reset' is useful if you want to start over from a
previous version of the code, while 'revert' is useful if you want to undo specific changes without
completely losing them.

26. What is the difference between ‘git remote’ and ‘git clone’?

The difference between 'git remote' and 'git clone' is that 'git remote' is a command that is used to
manage remote repositories in Git, while 'git clone' is a command that is used to create a local copy
of a remote repository. 'Git remote' allows you to add, remove, or modify the remote repositories
that are associated with your local repository, while 'git clone' creates a new local repository based
on a remote repository.

27. What is GIT stash?

GIT stash is a command that allows you to save changes made to a repository without committing
them. You can use 'git stash' to temporarily save changes that you are not ready to commit, and then
restore the changes later. This can be useful if you want to switch to another branch or if you want to
temporarily hide changes that are not ready to be committed.

28. What is GIT stash drop?

'GIT stash drop' is a command that allows you to permanently discard changes that were saved with
'git stash'. You can use 'git stash drop' to remove changes that are no longer needed, or if you want
to abandon changes that were temporarily saved.

29. Why do we need branching in GIT?

We need branching in Git because it allows us to create separate branches for different features or
projects, and to work on them independently without affecting the main branch. This allows us to
make changes, test new features, and collaborate with others, while keeping the main branch stable
and secure.

30. What is HEAD in Git, and how many HEADs can be created in a repository?

HEAD in Git refers to the current commit that is checked out in a repository. There can be multiple
HEADs in a Git repository, but only one of them is active at a time. The active HEAD is the one that is
currently being used to make changes, while the other HEADs represent other branches or previous
states of the repository.

31. What is the regular way for branching in GIT?

The regular way to create a new branch in Git is by using the "git branch" command followed by the
name of the new branch. This creates a new branch that is a copy of the current branch you are on.

32. State a way to create a new branch in Git.

To create a new branch in Git, you can use the following command: "git checkout -b [branch name]".
This creates a new branch and switches to it in one command.

33. How do you define a ‘conflict’ in git?

A conflict in Git occurs when two or more branches have made changes to the same file or set of
files, and Git cannot automatically merge these changes.

34. How to resolve a conflict in Git?

To resolve a conflict in Git, you need to open the conflicting file, find the conflicting changes, and
manually edit the file to choose which changes to keep and which to discard. Once you have resolved
the conflict, you need to stage the file with "git add" and then commit the changes with a descriptive
commit message. After that, you can continue to use Git as normal.

You might also like