top of page
Writer's pictureRajpreet Gill

Git vs GitHub

It's a common misconception that git and GitHub are the same thing. While Git is a version Control System that helps you manage changes to your code, GitHub is a Web-Based platform that provides a range of features for collaboration and sharing your code with others.





What is Git?

Git is a popular version control system. It was created by Linus Torvalds in 2005, and has been maintained by Junio Hamano since then.

It is used for:

  • Tracking code changes

  • Tracking who made changes

  • Coding collaboration



What does Git do?

  • Manage projects with Repositories

  • Clone a project to work on a local copy

  • Control and track changes with Staging and Committing

  • Branch and Merge to allow for work on different parts and versions of a project

  • Pull the latest version of the project to a local copy

  • Push local updates to the main project

  • Working with Git

  • Initialize Git on a folder, making it a Repository

  • Git now creates a hidden folder to keep track of changes in that folder

  • When a file is changed, added or deleted, it is considered modified

  • You select the modified files you want to Stage

  • The Staged files are Committed, which prompts Git to store a permanent snapshot of the files

  • Git allows you to see the full history of every commit.

  • You can revert back to any previous commit.

  • Git does not store a separate copy of every file in every commit, but keeps track of changes made in each commit!


Why Git?

  • Over 70% of developers use Git!

  • Developers can work together from anywhere in the world.

  • Developers can see the full history of the project.

  • Developers can revert to earlier versions of a project.


Working with Git Branches

In Git, a branch is a new/separate version of the main repository.

Let's say you have a large project, and you need to update the design on it.

How would that work without and with Git:


With Git:

  • With a new branch called new-design, edit the code directly without impacting the main branch.

  • EMERGENCY! There is an unrelated error somewhere else in the project that needs to be fixed ASAP!

  • Create a new branch from the main project called small-error-fix.

  • Fix the unrelated error and merge the small-error-fix branch with the main branch.

  • You go back to the new-design branch, and finish the work there.

  • Merge the new-design branch with main (getting alerted to the small error fix that you were missing).

Branches allow you to work on different parts of a project without impacting the main branch.

When the work is complete, a branch can be merged with the main project.

You can even switch between branches and work on different projects without them interfering with each other.

Branching in Git is very lightweight and fast!


Move further To GitHub:-


What is GitHub?

GitHub is an online software development platform. It's used for storing, tracking, and collaborating on software projects. GitHub is the largest host of source code in the world, and has been owned by Microsoft since 2018.

It is used for:

  • GitHub allows software developers and engineers to create remote, public-facing repositories on the cloud for free.

  • A repository, or "repo" for short, is a coding project’s files and the revision history for each file.

  • It makes it easy for developers to share code files and collaborate with fellow developers on open-source projects

  • Git is not the same as GitHub.

  • GitHub makes tools that use Git.



Here in the Picture we can see , Remote Repository as well as GitHub.


What does GitHub do?

  • GitHub users create accounts, upload files, and create coding projects. But the real work of GitHub happens when users begin to collaborate.

  • create issues or pull requests to collaborate on projects with other people.

  • While anyone can code independently, teams of people build most development projects. Sometimes these teams are all in one place at once time, but more often they work asynchronously.

  • Issues help you keep track of ideas and discuss possible changes to projects.

  • There are many challenges to creating collaborative projects with distributed teams.

  • GitHub makes this process much simpler in a few different ways.

  • Pull requests let you share your proposed changes with others, receive feedback, and merge changes into a project.

  • The flow of the GitHub is Create a new Branch, Make changes and add Commits, Open a Pull Request, Review, Deploy, Merge.


Why GitHub?

  • GitHub offers a unique, user-friendly interface that allows a novice coder to take advantage of Git.

  • That's great since, without GitHub, it would take more technical knowledge and use of the command line.

  • GitHub's interface is easy enough to help individuals manage other projects, such as journals.

Working with Git Branches

On GitHub, access your repository and click the "master" branch button.

Without Git:

  • Make copies of all the relevant files to avoid impacting the live version.

  • Start working with the design and find that code depend on code in other files, that also need to be changed!

  • Make copies of the dependent files as well. Making sure that every file dependency references the correct file name.

  • EMERGENCY! There is an unrelated error somewhere else in the project that needs to be fixed ASAP!

  • Save all your files, making a note of the names of the copies you were working on.

  • Work on the unrelated error and update the code to fix it.

  • Go back to the design, and finish the work there.

  • Copy the code or rename the files, so the updated design is on the live version.

  • (2 weeks later, you realize that the unrelated error was not fixed in the new design version because you copied the files before the fix).


Difference between Git and GitHub is Down









References:


I hope You guys enjoy the tutorial...

Thanks for Reading...

67 views

Recent Posts

See All
bottom of page