Git Tutorial for beginners (Git Bash Commands)


Git Tutorial for beginners, Git bash commands, svn, GitHub, Atlassian, TFS, Team Foundation Server, Team Foundation Services, TFS Online, Git server, Install Git on Windows, What is Git, Git commands for linux bash, Git cheatsheet - Published by Kunal Chowdhury on .

 

 

Version Control Systems are softwares tools that help a software team to manage changes to their source code. It keeps track of every modification to the code. If a mistake is made, developers can compare earlier versions of the code and/or revert back the changes to help fix the mistakes without disrupting the other team members.

 

As of now, the most widely used modern version control systems in the world are Git and TFS. Git is a mature, actively maintained open source project originally developed by Linus Torvalds, the famous creator of the Linux operating system kernel, in the year 2005.

 

Having a distributed architecture, Git is an example of "Distributed Version Control System" (DVCS). Rather than having only one single place for the full version history, every developer's working copy of the code can be treated as a repository in Git. In addition to being distributed, Git has been designed with performance, security and flexibility in mind.

 

 

Here is a list of some common terms used in Git, which you must know:

 

Blobs


Blob stands for Binary Large Object. Each version of a file is represented by blob, which holds the file data but doesn’t contain any metadata. It is a binary file and in Git database, it is named as SHA1 hash of that file.

 

Trees


Tree is an object as binary file, which represents a directory. It also holds blobs as well as other sub-directories. It stores references to blobs and trees which are also named as SHA1 hash of the tree object.

 

HEAD


HEAD is a pointer, which always points to the latest commit in the branch. Whenever you make a commit, HEAD is updated with the latest commit. The heads of the branches are stored in ".git/refs/heads/" directory.

 

Clone


Clone operation creates the local instance of the repository. It acts as mirroring of the complete remote repository. Users can perform any operations with this local repository. The only time networking gets involved is when the repository instances are being synchronized.

 

Branches


Branches are used to create another line of development from the repository's master branch to work on a new feature. Once the feature is completed, it is merged back with the master branch and we delete the branch. Every branch is referenced by HEAD, which points to the latest commit in the branch. Whenever you make a commit, HEAD is updated with the latest commit.

 

Pull


Pull operation copies the changes from a remote repository instance to the local repository. The pull operation is used for synchronization between two repository instances.

 

Push


Push operation copies changes from a local repository instance to the remote repository. This is used to store the changes permanently into the Git repository.

 

Commits


Commit operation holds the current state of the repository. A commit is also named by SHA1 hash code. Every commit object has a pointer to the parent commit object.

 

Tags


Tag assigns a meaningful name with a specific version in the repository. Tags are very similar to branches, but the difference is that tags are immutable. Once a tag is created for a particular commit, even if you create a new commit, it will not be updated. Usually, developers create tags for product releases.

 

 

Let's discuss about most used Git Bash commands:

 

 

 

 

 

 

 

 

 

Have a question? Or, a comment? Let's Discuss it below...

dhgate

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.