Advanced Developer’s Git tutorials and Latest Questions & Answers

What is Git?

the most widely used modern version control system in the world today is Git. Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvalds, the famous creator of the Linux operating system kernel. A staggering number of software projects rely on Git for version control, including commercial projects as well as open source. Developers who have worked with Git are well represented in the pool of available software development talent and it works well on a wide range of operating systems and IDEs (Integrated Development Environments).

Having a distributed architecture, Git is an example of a DVCS (hence Distributed Version Control System). Rather than have only one single place for the full version history of the software as is common in once-popular version control systems like CVS or Subversion (also known as SVN), in Git, every developer’s working copy of the code is also a repository that can contain the full history of all changes.

Merging vs. Rebasing

Merging vs. Rebasing

Git is all about working with divergent history. Its git merge and git rebase commands offer alternative ways to integrate commits from different branches, and both options come with their own advantages. In this article, we’ll discuss how and when a basic git merge operation can be replaced with a rebase.

Resetting, Checking Out, and Reverting

Resetting, Checking Out, and Reverting

The git resetgit checkout, and git revert commands are all similar in that they undo some type of change in your repository. But, they all affect different combinations of the working directory, staged snapshot, and commit history. This article clearly defines how these commands differ and when each of them should be used in the standard Git workflows.

Advanced Git Log

Advanced Git Log

The git log command is what makes your project history useful. Without it, you wouldn’t be able to access any of your commits. But, if you’re like most aspiring Git users, you’ve probably only scratched the surface of what’s possible with git log. This article walks you through its advanced formatting and filtering options, giving you the power to extract all sorts of interesting information from your Git repository.

Refs and the Reflog

Refs and the Reflog

ref is Git’s internal way of referring to a commit. You’re already familiar with many categories of refs, including commit hashes and branch names. But, there are many other types of refs, and virtually every Git command utilizes them in some form or another. You’ll walk away from this article with an intimate knowledge of Git’s inner workings.

Git Questions and Answers

Q1. What is the GIT command to blow away all changes since last commit?
Answer:- git checkout filename

Q2. What is the GIT command to skip staging and directly commit the changes directly ?
Answer:- git commit -a -m “message”

Q3. What does the command git add. do?
Answer:- Adds all the files to staging area

Q4. GIT takes care of access control.
Answer:- False

Q5. What is the GIT command to see all changes since the last commit ?
Answer:- git status

Q6. It is a good practice to use present tense in commit messages.
Answer:- True

Q7. GIT is a _
Answer:- Distributed Version Control System

Q8. After performing several commits, or cloning a repository with an existing commit history
Answer:- git log

Q9. What does the following command perform? Git reset –- soft HEAD^
Answer:- Move commit to one before current head

Q10. When I run git fetch from my local repo it will update my local code?
Answer:- False

Q11. What is the git command to directly create and move to a new branch?
Answer : git checkout -b branchname

Q12. What is the command to delete a branch in GIT?
Answer:- git branch -d branchname .

Q13. What is the GIT command to create a branch?
Answer:- git branch branchname

Q14. What does the command git checkout branchname do?
Answer:- Switches from main branch to the new branch

Q15. What is a good practice to follow when you want to back up a local branch?
Answer:- Push to remote repo

Q16. What does the GIT command ‘git remote prune origin’ do?
Answer:- Cleans up all remote stale repos

Q17. What is the command to delete a remote branch in GIT?
Answer:- git push origin : branchname

Q18. A tag in GIT context is a
Answer:- Reference to a specific commit

Q19. What is the GIT command to see all the remote branches?
Answer:- git branch -r

Q20. If you want to list all the changes and know who made them at what time , what command should you use?
Answer :- git which user

Q21. If you want to see the changes since last commit in a specific file, what command should you use?
Answer: git diff filename

Q22. What is the output of the following code ‘git log –- pretty = oneline’?
Answer:- Display one commit per line with SHA in the beginning

Q23. What is the GIT command to view the log with code level changes?
Answer : git log show code , git -l code

Q24. It is a good practice to include log files inside a repository.
Answer : False

Q25. What does the command ‘git log – – oneline – graph’ do?
Answer : Visual representation of the branch merging into master

Click here to read more Blogs

Click here to read more Git Interview Questions and Answers

About Author

After years of Technical Work, I feel like an expert when it comes to Develop wordpress website. Check out How to Create a Wordpress Website in 5 Mins, and Earn Money Online Follow me on Facebook for all the latest updates.

Leave a Comment