upstream = original repo (where you fetch updates)
It does NOT:
merge changes automatically
change the original repo
give you permission to push to upstream
Step 9 — Create a Feature Branch
Create and switch to a new branch:
git switch -c your-branch-name
Enter fullscreen mode
Exit fullscreen mode
Why branch?
Keeps your changes separate from the default branch
Makes PRs clean and reviewable
How to Confirm You’re on the Right Branch
Use any of these:
git status
Enter fullscreen mode
Exit fullscreen mode
Look for: On branch ...
Or:
git branch
Enter fullscreen mode
Exit fullscreen mode
The branch with * is your current branch.
Or quick output:
git branch --show-current
Enter fullscreen mode
Exit fullscreen mode
Why You Might See master Instead of main
Some repos use master as the default branch instead of main.
This is normal. There is no functional difference for this assignment.
Use whatever default branch exists in your repo.
Step 10 — Make Your Changes (index.html + style.css)
Edit your files:
vim index.html vim style.css
Enter fullscreen mode
Exit fullscreen mode
Vim basics:
When you first open a file, Vim is in command mode (you cannot type yet)
Press i to enter insert mode (so you can type and edit)
Press Esc to leave insert mode
Type :w then press Enter to save
Type :q then press Enter to quit
Type :wq then Enter to save and quit
Type :q! then Enter to quit without saving
Make your updates (student details + theme).
Step 11 — Stage, Commit, and Review History
Check what changed:
git status
Enter fullscreen mode
Exit fullscreen mode
Preview changes line-by-line:
git diff
Enter fullscreen mode
Exit fullscreen mode
Stage (add to the “next commit”):
git add index.html style.css
Enter fullscreen mode
Exit fullscreen mode
Commit (save snapshot):
git commit -m "Your descriptive commit note"
Enter fullscreen mode
Exit fullscreen mode
View history:
git log --oneline
Enter fullscreen mode
Exit fullscreen mode
Step 12 — Push Your Branch to GitHub
Push your branch:
git push -u origin your-branch-name
Enter fullscreen mode
Exit fullscreen mode
What -u does:
sets tracking so next time you can run git push without extra arguments
Step 13 — Open a Pull Request (PR)
On GitHub, go to your fork repo page. You should see a prompt like:
“Compare & pull request”
Create a PR:
Base repository: pravinmishraaws/Week-2---Git-GitHub-Assignment
Base branch: main or master (whatever the upstream uses)
Compare branch: your branch (your-branch-name)
Does a PR change the original repo?
No.
A PR is a request to merge. The upstream repo does not change until:
the maintainer approves and merges it
Suggested PR Description
You can paste this:
This pull request is for learning purposes only. The goal is to practice the GitHub pull request workflow, understand how forks and branches are compared, and learn how collaboration works in a real repository. The changes are intentionally simple and focused on hands-on learning rather than introducing new features. Thank you, Pravin, for providing open-source learning materials and repositories that make it easier to learn Git and GitHub through real practice.
Enter fullscreen mode
Exit fullscreen mode
Step 14 — Keep Your Fork Updated (Sync Upstream)
If upstream changes later:
git fetch upstream
Enter fullscreen mode
Exit fullscreen mode
Merge upstream changes into your default branch (example uses master):
git switch master git merge upstream/master
Enter fullscreen mode
Exit fullscreen mode
Push updates to your fork:
git push origin master
Enter fullscreen mode
Exit fullscreen mode
Notes:
Use main if your repo uses main instead of master.
fetch is safe because it downloads without changing files until you merge.
Debugging Example: UI Broke After CSS Update
Scenario:
You update style.css
The page layout looks broken
Find recent commits that touched the file:
git log -- style.css
Enter fullscreen mode
Exit fullscreen mode
Compare changes:
git diff
Enter fullscreen mode
Exit fullscreen mode
If you know the commit hash that introduced the issue:
git diff <good_commit_hash> <bad_commit_hash>
Enter fullscreen mode
Exit fullscreen mode
Why this matters (DevOps mindset):
You may not be the original author
You still need to identify what changed and when
Git history is a debugging tool, not just “backup”
Optional: Publish Under Nginx as /your-github-project/
This is optional, but it’s a great real-world deployment skill:
serve your Git assignment page alongside your React app via Nginx
Залишити відповідь