How to work with GIT and GitHub
Source: Dev.to
Challenges with Centralized Version Control Systems
- Single point of failure – All work stored on a central server; if it goes down, developers lose the ability to commit, collaborate, or retrieve past versions.
- Lack of offline capabilities – Developers needed a constant network connection to commit or pull updates; remote work without internet was difficult.
- Limited visibility and complex workflows – Hard to see who was working on what until changes reached the central server; collaboration often required sharing patches via email.
What is Git?
Git is an open‑source distributed version control system (VCS) that tracks changes in source code, allowing teams to collaborate, manage different versions, revert to previous states, and work offline with local repositories.
Key Concepts
- Distributed – Every contributor has a full copy of the repository on their machine, enabling offline and fast operations.
- Repository – A collection of all project files and their complete history; can be local or remote.
- Commit – A snapshot of changes saved to the local repository, accompanied by a descriptive message.
- Branch – An independent line of development, allowing work on features without affecting the main project.
- Staging area – A temporary space to prepare changes before committing.
- Remote repository – A shared online version of the project for collaboration (e.g., GitHub, GitLab).
Common Git Commands
git init # Initialize a new Git repository
git add . # Add changes to the staging area
git commit -m "Message" # Commit staged changes with a message
git push # Send local commits to a remote repository
git pull # Fetch and merge changes from a remote repository
git clone # Clone an existing remote repository
What is GitHub?
GitHub is a cloud‑based platform for storing, sharing, and collaborating on code. It builds on Git by providing hosting, collaboration tools, and a web interface.
Collaboration Features in GitHub
- Branches – Isolated workspaces for features or fixes, keeping the main branch stable.
- Pull request (PR) – A request to merge changes from one branch into another, facilitating code review and discussion before integration.
- Issues – Built‑in task tracking for bugs, enhancements, and other work items.
Impact
Git and GitHub have transformed the software development cycle by enabling efficient version control, offline work, and seamless collaboration. They reduce development risk, improve teamwork, and are now essential tools in modern software engineering.