Nowadays software development takes place in a distributive way. This article focuses on one such technology that supports distributed software development i.e., GIT and it’s application via GitHub.
What Is Version Control?
A system called version control, sometimes referred to as source control or revision control, keeps track of changes made to a file or group of files over time so that you may retrieve particular versions at a later time. Although it can be applied to any circumstance where several versions of something are made and may need to be monitored and recalled, it is most frequently employed in software development.
- 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 software where more than one developer may have access to the source code of a specific application and can modify changes to it that 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. It helps the team cope with the confusion that tends to happen when multiple people are editing the same files.
What Is GitHub?
GitHub is an web based platform which hosts software development projects and uses Git for version management. Git is a distributed version control system that helps developers to work together on same software projects and keep track of changes made to their code by on another. GitHub offers a user-friendly interface, which is very collaborative tools, and more project management tools, GitHub will enhance the potential of the Git.
GitHub allows developers to create and manage the code in the repository in the remote location where others can aceses the code or Github is an collection repositories which contains the files of the project.
What is Use Of 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.
What Are the Uses Cases Of GitHub?
Following are some of the use cases of GitHub
- Version Control: GitHub is also called an version control system because of it uses such has if the certain developers are working on the same project and if any developer make changes at it is effecting the entire code then they move back to previous version with immediate actions.
- Collaboration and Code Review: GitHub allows group of developers work on same project where there can review the each others code and can work on the same project which will improve the productivity and where they can develop the complex application in faster manner.
- Issue Tracking: Has an certain group of developers will work on the same project so when the issue arises in the GitHub then you can assign the issue to the other developer to whom you want.
- Open Source Development: The most widely used platform for open source development is GitHub.
What Are Characteristics of Git?
A. 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.
B. 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.
C. 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.
D. 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 is possible with a remote server.
E. 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 them being noticed.
F. 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.
G. 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 does GIT work?
- 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
Exploring The GitHub Interface
Github is an online platform where we can share our codes(or projects) online hassle-free. Github is place where we host our local git repository online. it basically allow you to work collaboratively within a group of peoples. It hosts all the features of Git and have its own too.
In simple words, Github might be considered as a social media which is made for the developers where they share their work. it might be any project regarding website development or any design of website, or some operating systems like Android, or Linux, etc.
Github is owned by Microsoft, provides access to public(free) and private(paid) repositories. It allows free repository to host files up to 100mb and total size for 2GB.
Let’s us see how to host to a local repository to Github, from very beginning(creating a github account).
A. Creating a GitHub Account
Step 1: Go to github.com and enter the required user credentials asked on the site and then click on the SignUp for GitHub button.
How To Get Started With GitHub
Step 1: Choose a plan that best suits you. The following plans are available as shown in below media as depicted:
Step 2: Then Click on Finish Sign Up. The account has been created. The user is automatically redirected to your Dashboard.
B. Creating a new Repository
- Login to your Github account
- On the dashboard click on the Green Button starting New repository.
- Make sure to verify the Github account by going into the mail which was provided when creating the account.
- Once verification has been done, the following screen comes
C. Start by giving a repository name, description(optional) and select the visibility and accessibility mode for the repository
D. Click on Create repository
E. The repository (in this case ITE-304 is the repository) is now created. The repository can be created looks like:
How To Upload Existing Repository to GitHub
- The system should have git installed in it if not install git. 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.
git add .
#Adds the files in the local repository and stages them for commit. To unstage a file, use
git reset HEAD YOUR_FILE
Commit the files that you’ve staged in your local repository.
git commit -m 'First commit'
# Commits the tracked changes and prepares them to be pushed to a remote repository.
To remove this commit and modify the file, use
git reset --soft HEAD~1
And commit and add the file again.
At the top of the GitHub repository’s Quick Setup page, click on the icon shown and copy the remote repository URL.
In the Command prompt, add the URL for the remote repository where your local repository will be pushed.
git remote add origin remote repository URL
# Connects to the remote repository
git remote -v
# Verifies the new remote URL
Push the changes in your local repository to GitHub.
git push origin master
# Pushes the changes in your local repository up to the remote repository you specified as the origin.
And here you go…
You may download changes from remote repository to local repository using the command:
Difference Between Git And GitHub
Git is an distributed version control system (DVCS).
GitHub is an web-based platform which helps git to host its repositories.
Git will track the changes in the projects that are made by the developers.
Github will helps you to tack the issue, pull request, code review and so on.
Git works on command line(CLI).
GitHub is an web-based graphical interface.
Git works in the local machine of developers by which you can commit changes, create branches, merge code.
GitHub is an remote hosting service by which other developers can accessible can pull and fetch the code according to there need.
Companies and Projects Using GIT
- The reputed and dream job companies of all the geeks like Microsoft, Google, Facebook, Twitter, LinkedIn, and 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.
Frequently Asked Question (FAQs) What is GitHub?
1. What is GitHub Copilot?
GitHub collaborated with the open AI and developed a tool called as an GitHub Copilot which is an artificial intelligence (AI) tool it will helps the coders by artificial intelligence (AI) tool.
2. What is GitHub Repository?
GitHUb repository is an repo where all the files of an project will be stored and entire history of the code will also be maintained.
3. What is GitHub Desktop?
GitHub Desktop Provides useres Graphical User Interface(GUI) where they can work with the git repositories which is will make it easy to use the git. Which reduces the efforts of users of memorozing the commands used in the git.
4. What is GitHUb Actions?
GitHub Actions is a CI/CD (Continuous Integration/ Continuous Deployment) platform for automating the builds, test, and deployment process.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!