
Tech • AI • Robotics • Game
⏱ ≈ 3 min read · 37-min video — 34 min saved
Git is a local version-control system that tracks file changes through commits, branches and restores, while GitHub adds remote hosting, collaboration tools, issues and pull requests.
Git is the open-source version-control software created by Linus Torvalds, while GitHub is a hosted platform built around Git repositories. Git manages history on a local machine; GitHub adds remote backup, sharing, review and workflow features. Other hosted options include GitLab and Bitbucket.
A project becomes a Git repository with git init, which creates the hidden .git directory that stores repository metadata and history. Before that, users typically set user.name, user.email and the default branch name, commonly main. Git can then report the repository state with git status.
New files begin as untracked. Running git add places them in the staging area, and git commit -m records them as a permanent checkpoint in repository history. git log --oneline then shows a compact list of commits, each identified by a unique hash.
Modified tracked files can be inspected with git diff, which highlights added and removed lines. After staging, git diff --staged shows what is about to be committed. If a local edit breaks something, git restore can reset the file back to the latest committed version.
A branch is an isolated line of work that lets developers experiment without changing main. New branches are created with git branch and entered with git switch. Each branch starts as a copy of current history, then diverges as new commits are added, making it possible to test features or AI-generated changes safely.
Once a feature branch is ready, git merge integrates it into main. If main has not changed since the branch split, Git can often perform a fast-forward merge. After merging, the feature branch can be removed with git branch -d to keep the repository tidy.
A local repository becomes shareable by creating a remote on GitHub and linking it with git remote add origin. The first upload uses git push -u origin main, while later updates usually require only git push. A remote copy can be downloaded elsewhere with git clone, and updates from GitHub arrive through git pull.
Files such as .env often contain secrets and should not be uploaded. A .gitignore file tells Git which files or patterns to leave out of commits and pushes. That prevents passwords, API keys and other private data from being published accidentally.
GitHub’s issues act as structured task lists for bugs, features or translations. Work can be done on a dedicated branch and submitted through a pull request, which proposes merging those changes into main. In one example, an AI-produced code review covered 43 files and about 4,000 lines of code, illustrating the scale that review tools now handle.
A pull request can be inspected on GitHub or checked out locally with gh pr checkout. After review, it can be merged in the web interface or by command line with GitHub CLI. Pull requests also tie back to issues, allowing a merge to automatically close the task it solves.
Merge conflicts arise when a branch and main both alter the same content before integration. GitHub can open a conflict editor that shows both versions and lets the user accept one side or combine both. Once resolved and committed, the pull request becomes mergeable again.
If a merged change proves harmful, GitHub can revert it by generating a new pull request that undoes the earlier merge. This preserves history rather than erasing it, which is important for accountability and traceability in collaborative projects.
Git provides the core mechanics for tracking, restoring and branching changes, while GitHub extends that model into a collaborative system for review and remote coordination. Together they form a standard workflow for managing both human-written and AI-generated work safely.
Ask a question