What is GIT (Global Information Tracker)

Author:vivek prasad


what is git
GIT (Global Information Tracker) is a powerful and distributed version control system. It is the most popular version control system today used in software development to track changes in source code. It helps in collaborating with others on a coding project. GIT was created by Linus Torvalds in 2005, the same guy who is also known for his contribution towards Linux Kernel.

Here are some of the key features of GIT.

1) Distributed


GIT unlike other centralized version control systems is distributed. All the developers working on a project have a complete copy of the entire repository. This allows the developer to work offline and celebrate among team members.

2) Version Control


GIT allows us to keep track of the changes made to the codebase over time. It records every change we make to the files which makes it easy to review the history, and we can revert to the previous state whenever we need.

3) Branching and merging


Creating branches in GIT is easy. Branches are created for independent lines of development. Developers can work separately on different branches for a new feature or a bug fix. After the change is done, the branches cab ve merged into the main or the master branch. In the industry, branches are also sometimes created on the basis of the environment where the code would be deployed.

4) Remote Repositories


GIT supports remote repositories on servers like GitHub, GitLab, and BitBucket. This helps developers to push and pull to a common repository and collaborate with each other.

5) Committing


Developers working on a codebase can commit the changes to the GIT Repository. Each commit is accompanied by a commit message that describes the changes made.

6) Conflict Resolution


Conflicts can arise when multiple developers are working on the same file. GIT provides tools to help resolve these conflicts during the merging process.

7) Tagging


User can use tags to mark the specific points in history. This is often used in version releases.

8) History


We can view the history of the project to check who made the changes when was the change made and what exactly was changed. This information is available for each and every commit.

9) Stashing


GIT provides a way to temporarily save changes that are not ready for the commit. This allows switching to a different branch or addressee an urgent issue without committing the incomplete code.

Below are some of the most commonly used GIT commands: -

1) git init


Initializes a new Git repository in the current directory.

2) git clone [repository_url]


Creates a copy of a remote Git repository on your local machine.

3) git add [file] or git add .


Stages changes for commit. You can specify individual files or use a dot to add all changes.

4) git commit -m "commit message"


Records the staged changes in a commit with a descriptive message.

5) git status


Displays the status of your working directory, showing which files are modified, staged, or untracked.

6) git diff


Shows the differences between the working directory and the last commit.

7) git branch


Lists all local branches, indicating the current branch with an asterisk (*).

8) git branch [branch_name]


Creates a new branch with the specified name.

9) git checkout [branch_name]


Switches to a different branch.

10) git merge [branch_name]


Merges changes from one branch into the current branch.

11) git pull


Fetches changes from a remote repository and merges them into the current branch.

12) git push


Pushes your local commits to a remote repository.

13) git remote -v


Lists all remote repositories connected to your local repository.

14) git log


Displays a history of commits, showing commit messages, authors, and commit IDs.

15) git stash


Temporarily saves changes that are not ready to be committed.

16) git tag [tag_name]


Creates a new tag for a specific commit, often used for version labeling.

17) git remote add [remote_name] [remote_url]


Adds a new remote repository.

18) git remote remove [remote_name]


Removes a remote repository.

19) git fetch [remote_name]


Fetches changes from a specific remote repository.

20) git reset [commit]


Resets the current branch to a specific commit, discarding all commits after it.

You can use "git --help" followed by a command to get more information on each command's usage and options.