Made with ScholarlyAsk questions about your own PDFs and videos
Shared by ali
This guide provides an overview of Git for version control, covering local repository management, branching, and team collaboration. It explains how to track file changes, handle conflicts, and manage project history using specific command-line instructions (pp. 2-10).
Version Control System (Git) — A tool used to track changes in project files over time, allowing developers to revert to previous versions or work on features simultaneously without creating duplicate folders like "project-final-final" (p. 2).
The Three Areas — Git organizes work into three main areas: the Working Directory (where you edit files), the Staging Area (where you prepare changes using git add), and the Repository (where history is saved using git commit) (p. 2).
Branching — Creating a separate path for development. For example, using git branch feature/login allows you to work on a login feature while the main branch remains stable (p. 4).
Merge Conflicts — Occur when Git cannot automatically merge changes because two people edited the same line differently. Git requires manual intervention to resolve these conflicts before finalizing the commit (p. 9).
Initial Setup (p. 3): To start a new repository, use git init. This creates a hidden folder that stores project history and configuration. You then use git add index.html (or git add .) to stage files and git commit -m "Add contact page" to record the change (p. 3).
Ignoring Files (p. 6): The .gitignore file prevents Git from tracking sensitive or unnecessary files. Typical entries include node_modules/, *.log, and .env (p. 6). Note: if a file is already tracked, you must remove it from the index first using git rm --cached <file> (p. 6).
Commit Message — "Short, specific, and logical" text describing a change. Examples include "Add login page" rather than generic terms like "Testing" (p. 3).
Remote Repository — A server-hosted version of your project, managed via services like GitHub, used for team collaboration (p. 2).
Git Reset Modes (p. 5): When using git reset, specific flags determine the target state of your working directory:
--soft: The branch pointer moves, but changes remain in the Staging Area.--mixed: The default; changes are moved out of the Staging Area into the Working Directory.--hard: The Working Directory and Staging Area are completely overwritten by the target version (p. 5).git pull (receives and merges remote changes) and git fetch (receives changes without automatically merging) (p. 7).git status → git add → git commit (p. 3).<<<<<<< HEAD, =======, >>>>>>> feature/login) and the process to resolve them (p. 9).git reset --hard: once executed, local uncommitted changes may be lost permanently (p. 5).Make from this