What is Version Control?
Version control is a system that records changes to files over time so you can recall specific versions later. It is essential for collaborative software development and for maintaining a history of your project.
Why Git?
Git is a distributed version control system, meaning every developer has a full copy of the repository, including its history. Key benefits include: non-linear development via branching, reliable merging, and the ability to work offline.
Key Git Commands
- git init — Initialize a new repository.
- git clone <url> — Clone an existing repository.
- git add <file> — Stage changes for the next commit.
- git commit -m "message" — Record staged changes with a message.
- git push — Upload local commits to a remote repository.
- git pull — Fetch and merge changes from a remote.
- git branch <name> — Create a new branch.
- git checkout <branch> — Switch to a different branch.
- git merge <branch> — Merge a branch into the current branch.
Branching Strategy
Keep main stable and deploy-ready. Do all feature work on short-lived feature
branches. Open a pull request to merge back into main so teammates can review the
code before it lands.
Good Commit Practices
Make atomic commits — each commit should do one thing. Write descriptive commit messages in the imperative mood: "Add export function" rather than "Added export function."
GitHub for Project Management
Link commits to issues by including the issue number in the commit message (e.g., "Fix layout bug closes #12"). Use pull requests for code review before merging feature branches.
Assignment
For next week, start working on the user stories created in the stand-up meeting today.