This guide introduces Git and GitHub for people who have heard of them but are not sure where to begin. It explains the basic ideas behind version control and how Git and GitHub can support everyday software development work.
Understand Git and GitHub
Before looking at the basic workflow, it helps to understand what each tool does and why developers use them.
Why Git and GitHub matter
Git manages and tracks versions of code. GitHub is a platform where Git repositories can be stored, shared, and used for collaboration. Together, they can make teamwork easier, reduce the risk of losing changes, and help you return to an earlier version when you need to correct a mistake.
Git and version control
Git is a type of version control system. It is designed to track and manage changes to files, especially source code.
What is version control?
Version control is a system for tracking and managing changes to files in a project, whether those files contain code, images, or documents. It keeps a history of changes so you can review earlier versions.
How version history works
A version control system records changes made to files. Depending on the system and workflow, a record may include when a change was made, who made it, and what was changed. This history makes it easier to compare revisions and return to an earlier state if something goes wrong.
Why teams use it
Version control helps team members work on a project without relying on confusing copies of the same file. It makes changes easier to track and can reduce accidental overwrites or data loss.
Example: revising a presentation
Imagine editing the same presentation several times. Version control can keep a history of those revisions so you can review or restore an earlier version rather than keeping many separate files.
Why use version control?
Version control becomes especially useful when a project grows or several people contribute to it.
Managing code without version control
Without version control, you may end up with files named “index.html,” “index_v2.html,” and “index_final.html.” It can quickly become difficult to tell which file is current or what changed.
Keeping work organized
Imagine a boy named Klang juggling several tasks and file versions. Version control can help him keep those files organized.
Backups, versions, and team work
Backing up code manually can take time. A version control workflow keeps a record of changes, helps you manage multiple versions, and gives teams a shared way to coordinate work. Team members still need a clear workflow to avoid conflicting edits.
Benefits at a glance
- Track changes to project files.
- Review or restore earlier versions.
- Make collaboration easier to coordinate.
- Reduce the risk of losing work.
- Keep a history that can support your backup process.
How version control evolved
Version control developed from manual copies of files and folders into more structured systems for recording changes.
Copying files and folders
One early approach was to copy files and label them by version, such as “index_v1.html” and “index_v2.html.” This can be difficult to manage as the number of revisions grows.
Patch-based changes
Patch (PAT) files record changes made to files and can reduce how much data needs to be stored, although this approach may still be inconvenient for everyday collaboration.
Local version control systems
A local version control system stores change history on your own computer. It can make version management easier, but collaboration with other people remains limited.
Centralized version control (CVCS)
A centralized version control system stores the project history on a central server, which gives a team a shared place to work. If that server is unavailable, the team may have difficulty accessing the shared history.
Distributed version control (DVCS)
A distributed version control system keeps a copy of the history on each user’s computer and can also use a central server for sharing. This design is presented as more flexible and secure than a centralized system, and contributors can still work with their local history when the central service is unavailable.
Git is a DVCS
Git is a distributed version control system used to track changes in a project. Its distributed design lets each contributor work with a local repository and share changes with others.
Git and GitHub: what is the difference?
Git and GitHub work together, but they are not the same thing. Git tracks and manages changes. GitHub is a hosting and collaboration platform for Git repositories.
Git: distributed version control
Git stores project history in a local repository and lets contributors record, compare, and manage changes.
Benefits of Git
- Track changes to files.
- Review previous versions.
- Coordinate work with a team.
- Work with a flexible project history.
GitHub: hosting for Git repositories
GitHub provides a place to host Git repositories, share code, and collaborate with other contributors.
Using Git with GitHub
Use Git to manage changes on your computer, then use GitHub to host and share the repository and collaborate with others.
Create a GitHub account
Creating an account is one of the first steps to using GitHub.
Sign up and verify your email
Visit GitHub, register with the requested account details, and follow the instructions to verify your email address.
Set up your profile
After verification, you can add profile information such as a name and image, along with any other details you want to share.
Create a remote repository on GitHub
A remote repository is an online home for a project that you can access through GitHub.
Set up a repository
After signing in, choose New on GitHub. Enter a repository name and description, then choose whether it should be public or private. Review the visibility setting before creating the repository.
💬 For a free financial consultation, contact the team on LINE, or scan the QR code to connect.