task 1
Wed Apr 23 2025 01:39:41 GMT+0000 (Coordinated Universal Time)
Saved by
@cciot
1. Create a Git Repository Locally
🛠 Steps:
1. Create a simple web app with 5 HTML pages:
mkdir my-web-app
cd my-web-app
touch index.html about.html contact.html services.html portfolio.html
2. Initialize Git:
git init
3. Stage and commit the files:
git add .
git commit -m "Initial commit with 5 HTML pages"
2. Push to GitHub and Explore Remote Options
🛠 Steps:
1. Go to GitHub and create a new repository (e.g., my-web-app).
2. Connect local repo to GitHub:
git remote add origin https://github.com/your-username/my-web-app.git
3. Push to GitHub:
git push -u origin main # or master, depending on your default branch
🔍 Explore:
Push updates:
git push origin main
Pull latest changes from remote:
git pull origin main
Fetch updates (without merging):
git fetch origin
3. Clone, Modify, and Push Back
🛠 Steps:
1. Clone the repo in another folder:
git clone https://github.com/your-username/my-web-app.git
2. Modify a file (e.g., edit about.html), then:
git add about.html
git commit -m "Updated about page content"
git push origin main
4. Create Branches and Merge
🛠 Steps:
1. Create and switch to new branches:
git checkout -b feature-header
# make changes
git add .
git commit -m "Added header"
git checkout -b feature-footer
# make changes
git add .
git commit -m "Added footer"
2. Merge into main:
git checkout main
git merge feature-header
git merge feature-footer
git commit -m "Merged header and footer features"
5. Publish with GitHub Pages
🛠 Steps:
1. Push all content to the main branch.
2. Go to your GitHub repository > Settings > Pages.
3. Under Source, choose main branch and root folder /.
4. GitHub will provide a URL like:
https://your-username.github.io/my-web-app/
content_copyCOPY
Comments