Check these top Git interview questions which have been chosen by industry experts to give you an advantage in your Git interview. You will learn about Git advantages, what is Git Stash, how to create a Git repository, creating a new Git branch, resolving a conflict in Git and more. Learn Git from Intellipaat DevOps course and fast-track your career.
Here we list some of the most important differences between Git and SVN:
Here are some of the most important advantages of Git:
C is the programming language that is used for creating Git which ensures that the overheads are reduced.
Learn for free ! Subscribe to our youtube Channel.
Since Git is an open source version control system it lets you run multiple versions of your project so that it shows the changes that are made to the code over time and if needed you can keep a track of the changes that you have made. This means that large number of developers can make their own changes and upload those changes so that the changes can be attributed to the particular developers.
When you are making the commits you can make changes to it, format it and review it in the intermediate area known as ‘Staging Area’ or ‘Index’.
The Git stash will take the working directory in the current state and index it to put on the stack at a later stage so that what you get is a clean working directory. This means that if you are in the middle of some task and need to get a clean working directory and simultaneously you want to keep all your current edits then you can use the Git stash.
When you are finished with working on the stashed item or want to remove the list then you can use the Git stash drop. This will ensure that the item that is last added by default or any particular item can be removed from the argument.
Git branch –merged master – shows all branches that are merged into master
Git branch – merged – shows all branches that are merged into the head
Git branch – no-merged –shows all the branches that are not merged
The Git clone command lets you copy the existing Git repository. If you want to get a copy of the central repository then the best way to do it is using ‘cloning’.
The ‘Git config’ is a great way to configure your options for the Git installation. Using this command you can define the repository behavior, preferences and user information.
If you want to create a repository in Git then you need to run the command “git init”. With this command .git repository you can create a directory in the project directory.
The reference to a commit object is called as the ‘head’. Every repository has a ‘Master’ which is the default head. There can be multiple heads in a repository.
With the help of branching you can have your own branch and you can also jump between the various branches. You can go to your previous work while at the same time keeping your recent work intact.
The best way to create a branch in GIT is to have one ‘main’ branch and then create another branch for implementing the changes that you want to make. This is extremely useful when there are a large number of developers working on a single project.
If you want to create a new feature into the main branch then you can use the command ‘git merge’ or ‘git pull’.
If you want to merge a commit there is a change in one place and same change already exists then while merging the Git will not be able to predict which is the change that needs to be taken precedence.
If you want to resolve a conflict in Git then you need to edit the files for fixing the conflicting changes and then you can run “git add” to add the resolved files and after that you can run the ‘git commit’ for committing the repaired merge.
Your email address will not be published. Required fields are marked *
Solve : * 11 + 17 =