Git is a fast, scalable, distributed revision control system. With a very rich instruction set that provides both high-level manipulation and full access to its internals. It allows you to track code changes, revert to previous phases, create branches, and collaborate with colleagues. In this guide, we will see some of its features and how to configure Git after installation and learn about some basic Git commands.
- To track source code changes
- Use of distributed version control tools for source code control
- It allows multiple developers to work together
- Supports non-linear development through thousands of parallel branches
- In addition, it supports backup creations.
Configure Git After Installation
After installing git, it’s a good idea to set up personal information that will be used when committing code.
- Firstly login to your Ubuntu system, and open the terminal, after that enter the given command to register your Git Username. Replace the “user_name” argument with your actual username with quotes.
# git config –global user.name “user_name”
- After that use the given command to register the email. Replace the “[email protected]” with your actual email with quotes included.
# git config –global user.email “[email protected]”
- Lastly to verify the process enter the given commands. Afterward, the Git is confirmed for codes.
# git config –list
Working With Git
While working with Git we get options to use two repositories the first one is a Local Repository, and the second one is a Remote Repository.
- Local repository: A local repository resides on your computer and consists of all files and folders. This repository is used for local changes, checking history, and pushing offline.
- Remote repository: A remote repository is a server repository that can exist anywhere. This repository is used by all team members to share any changes made.
In this guide, we will see some basic commands to get started with Local Repository.
Git Basic Commands For Local Repository
- git status: The git status command tells the current state of the repository.
- git diff: It is a multi-use Git command that when executed runs a diff function on Git data sources.
- git add: Add command is used after checking the status of the files, to add those files to the staging area.
- git add -p: Whereas these add-p commands add selected changes into your next commit.
- git init: The command git init is used to create an empty Git repository.
- git commit: The commit command makes sure that the changes are saved to the local repository.
- git config: The git config command is used initially to configure the user_name and user_email. This specifies what email id and username will be used from a local repository.
- git checkout: The git checkout command is used to switch branches, whenever the work is to be started on a different branch.
Git is one of the world’s most popular distributed version control systems. This free tool has many valuable features, allowing developers to modify their code and undo the changes if necessary. In conclusion, we saw how to configure GIt and learned about some basic commands for Git Local Repository. If you have any further insights or questions, leave them in the comments section below or reach us at here.