1. Fundamentals of Git
Why Version Control Matters
- Maximized Collaboration Efficiency: When multiple developers work on the same project, version control helps minimize conflicts and provides transparent tracking of code changes.
- Easy History Tracking and Restoration: You can revisit or roll back to any previous point in the project’s history, aiding bug tracking and urgent rollbacks.
- Safe Experimentation via Branches: Work on features in parallel and merge them back into the main line only after thorough review and testing.
Key Concepts in Git
1. Repository
- The complete storage of a project’s history (commits, branches, etc.).
- Consists of a local repo on your machine and a remote repo on a hosting platform.
2. Staging Area
- A temporary area where you decide which changes in the working directory will become part of the next commit.
- Use git add to move changes from your working directory to the staging area.
3. Commit
- A recorded snapshot of changes in the staging area.
- Every commit represents a discrete point in your project’s development timeline.
4. Branch
- A parallel line of development. It allows you to develop a feature independently, then merge it back into the main line once it’s stable.
5. HEAD Pointer
- The pointer indicating the current working branch and commit.
- Typically points to the latest commit on your current branch; it advances automatically when you create a new commit.