Nowadays software development takes place in a distributive way. This article focuses on one such technology that supports distributed software development i.e GIT.
What GIT is about?
- Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
- Git relies on the basis of distributed development of a software where more than one developer may have access to the source code of a specific application and can modify changes to it which may be seen by other developers..
- Initially designed and developed by Linus Torvalds for Linux kernel development in 2005.
- Every git working directory is a full-fledged repository with complete history and full version-tracking capabilities, independent of network access or a central server.
- Git allows a team of people to work together, all using the same files. And it helps the team cope up with the confusion that tends to happen when multiple people are editing the same files.
Why Use Version Control Software?
- Version control software allows the user to have “versions” of a project, which show the changes that were made to the code over time, and allows the user to backtrack if necessary and undo those changes.
- This ability alone – of being able to compare two versions or reverse changes, makes it fairly invaluable when working on larger projects.
- In a version control system, the changes would be saved just in time – a patch file that could be applied to one version, in order to make it the same as the next version.
- All versions are stored on a central server, and individual developers checkout and upload changes back to this server.
Characteristics of Git
- Strong support for non-linear development
- Git supports rapid branching and merging, and includes specific tools for visualizing and navigating a non-linear development history.
- A major assumption in Git is that a change will be merged more often than it is written.
- Branches in Git are very lightweight.
- Distributed development
- Git provides each developer a local copy of the entire development history, and changes are copied from one such repository to another.
- The changes can be merged in the same way as a locally developed branch very efficiently and effectively.
- Compatibility with existing systems/protocol
- Git has a CVS server emulation, which enables the use of existing CVS clients and IDE plugins to access Git repositories.
4. Efficient handling of large projects
- Git is very fast and scalable compared to other version control systems.
- The fetching power from a local repository is much faster than what possible with remote server.
- Data Assurance
- The Git history is stored in such a way that the ID of a particular version depends upon the complete development history leading up to that commit.
- Once published, it is not possible to change the old versions without it being noticed.
- Automatic Garbage Collection
- Git automatically performs garbage collection when enough loose objects have been created in the repository.
- Garbage collection can be called explicitly using git gc –prune.
- Periodic explicit object packing
- Git stores each newly created object as a separate file. It uses packs that store a large number of objects in a single file (or network byte stream) called packfile, delta-compressed among themselves.
- A corresponding index file is created for each pack file, specifying the offset of each object in the packfile.
- The process of packing can be very expensive computationally.
- Git allows the expensive pack operation to be deferred until later when time does not matter.
- Git does periodic repacking automatically but manual repacking can be done with the git gc command.
How GIT Works
- A Git repository is a key-value object store where all objects are indexed by their SHA-1 hash value.
- All commits, files, tags and filesystem tree nodes are different types of objects living in this repository.
- A Git repository is a large hash table with no provision made for hash collisions.
- Git specifically works by taking “snapshots” of files
Creating a GitHub Account:
- Go to github.com and enter the required user credentials asked on the site and then click on SignUp for GitHub button.
2. Choose a plan that best suits you. The following plans are available:-
The account has been created. The user is automatically redirected to your Dashboard.
- Creating a new Repository
- Login to your Git Hub account
- On the dashboard click on the Green Button stating New repository.
- Make sure to verify the Git hub account by going into the mail which was provided when creating the account.
- Once verification has been done, the following screen comes
5. Start by giving a repository name, description(optional) and select the visibility and accessibility mode for the repository
6. Click on Create repository
7. The repository (in this case ITE-304 is the repository) is now created. Repository can be created
Uploading existing file to GitHub
- The system should have git installed in it. For installing git please refer https://git-scm.com/downloads. Make sure to choose Run git from Windows Command prompt option during installation. Otherwise open git bash in place of step 2.
- Open Terminal (for Mac users) or the command prompt (for Windows and Linux users).
- Change the current working directory to your local project
- Initialize the local directory as a git repository in different ways as described in the image.
A new .git folder is created in the directory which is by default hidden.
Add the files in your new local repository. This stages them for the first commit.
Commit the files that you’ve staged in your local repository.
At the top of the GitHub repository’s Quick Setup page, click on the icon shown and copy the remote repository URL.
Push the changes in your local repository to GitHub.
Companies and Projects Using GIT
- The reputed and dream job companies of all the geeks like Microsoft, Google, Facebook , Twitter, LinkedIn, Netflix make use of GIT.
- Open source projects like: Ruby On Rails, jQuery, Perl, Debian, the Linux Kernel and many more make use of git.
Tutorials for learning Git in depth:
Article By Mudit Maheshwari:
A 3rd year B.Tech IT student from VIT University, Vellore having keen interest in coding , learning about new technology and developing softwares . Besides being passionate about coding, he also loves playing guitar and singing. Currently staying in Chennai. You can reach him at firstname.lastname@example.org.
If you also wish to showcase your blog here,please see GBlog for guest blog writing on GeeksforGeeks.
- List of useful Github Commands
- Bitbucket vs GitHub vs GitLab
- Creating Repository in GitHub
- An Ultimate Guide to Git and Github
- What is GitHub Student Developer Pack and How to Get it?
- 5 GitHub Repositories that Every New Developer Must Follow
- Using Bitbucket as an extension to GitHub capabilities
- Downloading gists from Github made simple
- Using GitHub to host a free static website
- Making your first Open Source Pull Request | Github
- Fetch top 10 starred repositories of user on GitHub | Python
- SAP | An Introduction
- HQL | Introduction
- Robotics | Introduction
- Prolog | An Introduction