Objective:
To use Git effectively for managing the development of a web page created with HTML and CSS, encompassing version control, branching, merging, and collaboration.
Outcome:
Students will have a practical understanding of Git workflows in the context of a real web page project, enhancing their ability to maintain a clean, organized, and collaborative codebase.
Step-by-Step Guide
Setup and Initialization
Create a New Web Page Project:
Create a new folder for your project.
Add your HTML and CSS files.
Initialize a New Git Repository:
git init
Create a .gitignore File:
Add files and folders to exclude (e.g., node_modules, dist).
First Commit
Stage the Initial Project Files:
git add .
Commit the Staged Files:
git commit -m"Initial commit with HTML and CSS files"
Branching for Feature Development
Create a New Branch for Developing a Specific Feature:
git branch feature-x
Switch to the New Branch:
git checkout feature-x
Regular Commits
Make Changes in the Application Code.
Use git status to View Untracked or Modified Files:
git status
Stage and Commit Changes Regularly with Descriptive Messages:
git add .
git commit -m"Add feature X"
Merging Features into Main Branch
Switch to the Main Branch:
git checkout main
Merge the Feature Branch:
git merge feature-x
Resolve Any Merge Conflicts if They Arise.
Using Remote Repositories
Connect to a Remote Repository (e.g., on GitHub):
git remote add origin [remote-repository-URL]
Push the Local Repository to the Remote Repository:
git push -u origin main
Collaboration
Clone Each Other’s Repositories:
git clone [repository-URL]
Create New Branches, Make Changes, and Submit Pull Requests.
Practice Pulling Updates from the Remote Repository:
git pull origin main
Review and Reflection
Regularly Review the Commit History:
git log
Discuss What Each Commit Achieves and How It Contributes to the Project.
Deliverables
A fully functional web page managed with Git.
A series of branches representing different features or fixes.
A clear history of commits with descriptive messages.
Documentation of key Git commands used throughout the project.
Assessment Criteria
Effective use of Git commands.
Consistency in committing changes with clear, descriptive messages.
Successful implementation of branching and merging without significant conflicts.
Collaboration through pull requests and updates from remote repositories.