DEV Community

Cover image for How to work with GIT and GitHub
jeff kamuthu
jeff kamuthu

Posted on

How to work with GIT and GitHub

Before Git and GitHub were developed, the software development cycle faced significant challenges due to limitations of centralized version control systems (CVCS). Their architecture presented challenges especially in:

  1. Single point of failure: All the project's work was stored on a central server. In the case that the server went down or became corrupted, all developers lost the ability to commit changes, collaborate or retrieve past versions of the project.

  2. Lack of offline capabilities: Dev's needed a constant network connection to the central server to commit changes or pull updates. Working remotely without internet was quite difficult.

  3. Limited visibility and complex workflows: It was very hard to get a clear overview of who was working on what changes until the changes were committed to the central server. The collaboration process was very difficult and entailed sharing patches via email.

So what is Git?

Git is an open-source distributed version control system (VCS) that tracks changes in source code in the software development cycle, allowing teams to collaborate, manage different versions, move back to previous versions and work offline efficiently with local repositories.

Git Key concepts

  • Distributed: Every individual working on the project has a fully copy of the repository on their local machine enabling offline and fast operations.
  • Repository: A collection of all the project files and their complete history which can be local or on a remote server.
  • Commit: A snapshot of changes saved to the local repository. It also includes a message of what you changed and lets you go back to that point if later needed.
  • Branch: This is an independent line of development, letting individuals work on different features without affecting the main project.
  • Staging area: A temporary space to prepare changes before committing them.
  • Remote repository: A shared online version of the project for collaboration i.e. Gitlab, GitHub.

Common Git commands

git init: Starts a new Git repository.
git add: Puts your changes into the staging area
git commit: Save staged changes to the local repository
git push: Moves local commits to a remote repository
git pull: Downloads changes from a remote repository
git clone: Downloads an existing remote repository

What is GitHub?

GitHub is a cloud-based platform where you can store, share and work with other individuals to write code. GitHub is built on top of Git as Git is the tool, while GitHub provides the service.

Collaboration features in GitHub

  1. Branches: Different versions of the project for features and fixes. This is to keep the main branch safe, by creating isolated workspaces preventing changes from conflicting.
  2. Pull request (PR): This is a request to merge changes from one branch into another branch. It acts as a request to review the changes and merge them to the main branch.
  3. GitHub issues: Task tracking system built into every GitHub repository. Used to track bugs, tasks or feature requests.

Git and GitHub have significantly improved the software development cycle by enabling efficient version control and seamless collaboration. Git allows developers to track changes, work offline and manage multiple versions of a project safely, while GitHub provides a shared platform for teamwork, code reviews and issue tracking. Together, they have reduced development risks, improved collaboration and become essential tools in modern software development.

Top comments (1)

Collapse
 
mattw0110 profile image
Mattw0110

Well explained thank you