Open Source Contribution
Fork greeting-kit, add a farewell , respond to review, resolve a real conflict with main, and undo a published merge with revert.
YOUR BUILD CHECKLIST
- Fork greeting-kit. The starter already contains greet and a README.
- On branch add-farewell, commit the farewell and a README mention.
- Open a pull request from add-farewell into greeting-kit main.
- Read the reviewer comments and commit the exclamation point they asked for.
- Pull the upstream greet change, then resolve the conflict markers in greet.js.
- Merge the feature into main and push it.
- A teammate already pulled that main. Revert the bad commit. Do not reset.
- Tag v1.0.0 on the reverted history.
1. Fork
greeting-kit is the upstream. git fork greeting-kit copies its commits into a repository you own and sets origin to greeting-kit. Your later commits stay on the fork until you push.
2. Feature commits
The change is concrete: add farewell next to greet, returning Goodbye, plus the name. Put that in greet.js. Mention farewell in README.md. Those are two commits on add-farewell.
3. Pull request
git pr new add-farewell greeting-kit:main "Add farewell" stores the request from your fork to the upstream main. Opening it does not merge.
4. Review
The reviewer asks for an exclamation point on farewell and a README mention. Change the function so it returns Goodbye, name! and commit that follow-up on the same branch.
5. Upstream conflict
After the follow-up, origin/main changes greet to Hello, name! Pull that commit. greet.js gets conflict markers because both sides edited it. Keep both the new hello and your farewell, delete the markers, add, and commit.
6. Merge
Check out main, merge add-farewell, and git push origin main. That is the merge of the pull request. The upstream branch moves.
7. Revert
A teammate already pulled this main, so the farewell should not have merged yet. git reset and git push --force would erase their copy. git revert HEAD writes a new commit that undoes the tip, and the following push is a fast-forward.
8. Tag
git tag v1.0.0 names the commit you would ship. The tag is a label on that commit, not a second copy of the files.
Step 1
Fork the starter
greeting-kit already has commits for greet. This copies that history into your fork.
Step 2
Start the feature branch
The change is a farewell function next to greet.
Step 3
Add farewell
In the editor, set greet.js to: export function greet(name) { return "Hello, " + name; } export function farewell(name) { return "Goodbye, " + name; }
Step 4
Stage and commit
First commit of the feature.
Step 5
Save the feature
The graph on your fork grows. greeting-kit does not.
Step 6
Mention it in the README
Add this sentence in README.md: farewell(name) returns a goodbye.
Step 7
Commit the note
Run git add README.md, then this commit.
Step 8
Open the pull request
The request proposes add-farewell into greeting-kit main. Reviewer comments appear after it opens.
Step 9
Address the review
Change farewell so it returns Goodbye, name with an exclamation point. Keep greet as it was.
Step 10
Commit the follow-up
Run git add greet.js, then this commit. origin/main then moves and will conflict.
Step 11
Fetch the new main
Fetch records origin/main. Your branch does not move.
Step 12
Pull and resolve
Pull merges origin/main. The editor shows conflict markers in greet.js. Keep the enthusiastic greet and farewell with an exclamation point, delete the markers, then git add greet.js and git commit -m "resolve greet".
Step 13
Update local main
The pull request merges when main contains the feature.
Step 14
Merge the feature
This brings add-farewell into main.
Step 15
Publish the merge
A teammate pulls this main as soon as the push finishes. After this, reset would throw their copy away.
Step 16
Revert, do not reset
The farewell commit should not have landed yet. A teammate already pulled it, so reset and force-push would erase their copy. Revert the farewell commit.
Step 17
Push the revert
This push is a fast-forward. The bad commit stays in the history.
Step 18
Tag the release
The tag names the commit you would ship.
The editor edits the working tree. Start a repository and the files appear here.
Commit graph
No commits yet. git init creates the first one.
Make it your own
The original works. These are your next experiments.
- Optional: tag v1.0.1 after a second small README fix.
- Optional: open a follow-up pull request that only changes the README.