Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

Another option for merging in git and its syntax?

Answer» ANOTHER option for MERGING in git and its SYNTAX?
To do merging in git there is alternative and this is "Rebasing" and syntax for rebase is given below:-

git rebase [new-commit]
2.

How do you know that branch has been already merged into master in Git?

Answer»

How do you know that branch has been already merged into MASTER in Git?
(1)Git branch --merged:- This COMMAND will lists all the branches that have been merged into the CURRENT branch.
(2)Git branch--no-merged:-This command will lists the branches that have not been merged.

3.

Different steps to resolve a conflict in Git in any files?

Answer»

Different steps to resolve a conflict in Git in any files?
Below are the FOUR main steps to resolve the conflict in Git in any files:-
(1)FIRST need to identify the files that have the conflict.
(2)Now make the necessary CHANGES in the files so that the conflict will never arise again.
(3)Now in third STEP is to add files by the command git add
(4)Now the last steps is to commit the changed file using the command git commit

4.

What is Subgit and what is the use of this?

Answer»

What is Subgit and what is the use of this?
Subgit is a tool for doing stress-free and smooth MIGRATION of SVN to GIT. And from subgit we can do company-wide migration from SVN to Git with below points:-
(1)This tool is much better than git-svn
(2)And we donot need to change the infrastructure that is already PLACED.
(3)And this will ALLOW us to use git and all sub-version features.
(4)This will PROVIDES a genuine stress free and smooth migration experience.

5.

Why Git is fast and which language is used in GIT?

Answer»

Why GIT is fast and which LANGUAGE is USED in GIT?
Git is very fast BECUASE of the language it is used. This make it very fast. Git used "C" language which is reducing the OVERHEAD of runtimes which is associated with higer languages.

6.

Define different ways to get list all change files after Git Commit?

Answer»

Define DIFFERENT ways to get list all change files after Git Commit?
If your a programmer and WORKING on projects there are CERTAIN situation when programmer need to check all files that are modified after Git Commit. Some time programmer look for changes done during various commits before pushing their code to Git Repository. Below are the different ways to get all changes files:-

(1)By USING git log:-This is very popular method to get all commit id and changes done through this commit ID by using git log command. We use git log -p command that will provide you all the Commits along with the changes done in each Commit.
git log -p

(2)By using git show:-By using this command we can check all the changes done on a SPECIFIC Commit ID.
git show < Commit ID>
or
git show b4a7655b6821c4d1901

(3)By using git diff:-git diff command to check the list of files modified between two Commit IDs
git diff --name-only < StartCommitID>..< EndCommitID>
or
git diff --name-only 8349ce8b0f67686f2d..9219b4a7655b6821c4d1901

7.

What is syntax to fix a broken commit in GIT?

Answer»

What is SYNTAX to fix a broken commit in GIT?
To fix any broken commit we need to APPLY below command or syntax

git commit --amend

When we run above command we can fix the broken commit MESSAGE in the EDITOR.

8.

How can you rename a Local or Remote Branch in Git?

Answer»

How can you rename a Local or Remote Branch in Git?
Git is one of the famous VERSION control system which is used by software developers to keep track changes in their application and collaborate with others. One of the main FEATURE of Git is branches.
Here different people works on different branches before merging their changes with the ORIGINAL code.
And you can add new features or fix bugs on a different branch without affecting to the original code.
And there are certain situation when you need to change the name of local branch or the remote branch. Below are the steps to change the name of branches:-

(1)Rename a local git branch:-

(i)In first step to see branche run below command
git branch --list or git branch -a

(ii)Now in second step switch to branch you want to rename by below command
git checkout branch-name

or we can use below command to switch to branch
git switch branch-name

(III)In last step we will run the command to rename the branch
git branch -m new-name


(2)Rename a Remote git branch:-Rename a Remote banch is not same as local branch.
(1)In first step delete the OLD name by running below command
git push origin --delete old-branch-name

(2)In second and last step reset the upstream branch to the name of your new local branch by running below command
git push origin -u new-branch-name

And to check this rename log into your client website and check the repo.

9.

What is GitLive new features that will change the game?

Answer»

What is GitLive new FEATURES that will change the GAME?
GitLive has recently ANNOUNCE that GitLive now works in offline mode with any of Git Repository in VS Code. In its previous release it will only support four hosting services
(1)GitHub
(2)GitLab
(3)Bitbucket
(4)Azure DevOps
And this will also required to authorize access to SERVICE before start of using it.

But now once you install GitLive it will start in offline mode. And this offline mode uses data from local Git repository only and nothing is sent outside of network. And here repository should have a remote but it can be HOSTED anywhere.

10.

Difference between Git and SVN

Answer»

Difference between Git and SVN
Below are the six main difference between Git and SVN
(1)Git:-Here commits is possible even we are OFFLINE.
(1)SVN:-We can do commits in case when your are online.

(2)Git:-In git works are shared automatically by doing commit.
(2)SVN:-Here nothing is shared automatically.

(3)Git:-In Git Push/Pull operations are faster.
(3)SVN:-Here SVN are much slower in Push/Pull operations.

(4)Git:-Git is a Decentralized Version Control tool
(4)SVN:-SVN is a Centralized Version Control tool

(5)Git:-In Git client can clone the full repositories on their local systems
(5)SVN:-In SVN version history is stored on a server-side repository

(6)Git:-SVN belongs to 3RD generation of version control tools.
(6)SVN:-On the other HAND SVN is 2nd generation of version control tools.

11.

Write down the top 19 git commands?

Answer»

Write down the top 19 git commands?
Below are the top 19 git commands by uses
(1)git config
(2)git init
(3)git clone
(4)git add
(5)git commit
(6)git diff
(7)git reset
(8)git status
(9)git rm
(10)git log
(11)git show
(12)git tag
(13)git branch
(14)git checkout
(15)git merge
(16)git remote
(17)git push
(18)git pull
(19)git STASH
(1)git config:-We USE this command to sets the author name and email address respectively which is used with our commit.
(2)git init:-We used this command to start a new repository.
(3)git clone:-We used this command is used to obtain a repository from an existing URL.
(4)git add:-We used this command to add file to staging area.
(5)git commit:-We used this command records or snapshots the file permanently in the version history.
(6)git diff:-We used this command to shows the file differences which are not yet staged.
(7)git reset:-This command unstages the file, but it preserves the file CONTENTS.
(8)git status:-From this command we get all the FILES that have to be committed.
(9)git rm:-We used this command to deletes the file from our WORKING directory and stages the deletion.
(10)git log:-We used this command to list the version history for the current branch.
(11)git show:-From the help of this command it will shows the metadata and content changes of the specified commit.
(12)git tag:-We used this command to give tags to the specified commit.
(13)git branch:-From the helps of this command we will get lists of all the local branches in the current repository.
(14)git checkout:-Generlly we used this command to switch from one branch to another.
(15)git merge:-We use this command to merges the specified branchs history into the current branch.
(16)git remote:-We used this command to connect our local repository to the remote server.
(17)git push:-We used this command to commit changes of master branch to our remote repository.
(18)git pull:-We used this command to fetches and merges changes on the remote server to our working directory.
(19)git stash:-We used this command to temporarily stores all the modified tracked files.

12.

Push command in Git in branch to origin server?

Answer»

Push command in Git in branch to origin server?
If we want to push our master branch to our origin server. We can run this to push any commits you ve DONE back up to the server

$ git push < remote> < branch >

This above command will WORKS if we cloned from a server where you have WRITE access and noone is pushed in meantime. And if you and SOMEONE else clone at the same time and they push upstream and then you push upstream, your push will rightly be rejected. Below is the SYNTAX for the same:-

$ git push origin master

13.

How to rename and remove branch in remote Git?

Answer»

How to rename and remove BRANCH in remote Git?
In git to rename a branch in remote below COMMAND is USED
$ git remote rename oldname newname
$ git remote
origin
newname

And now to remove the branch below command is used
$ git remote remove newname
$ git remote
origin