Skip to content
engineering workbench.by StudyPort Academy
All projects
Advanced75 min

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.

ForkPull requestReviewConflictRevertTag

YOUR BUILD CHECKLIST

  1. Fork greeting-kit. The starter already contains greet and a README.
  2. On branch add-farewell, commit the farewell and a README mention.
  3. Open a pull request from add-farewell into greeting-kit main.
  4. Read the reviewer comments and commit the exclamation point they asked for.
  5. Pull the upstream greet change, then resolve the conflict markers in greet.js.
  6. Merge the feature into main and push it.
  7. A teammate already pulled that main. Revert the bad commit. Do not reset.
  8. Tag v1.0.0 on the reverted history.
  1. 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. 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. 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. 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. 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. 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. 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. 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.

  1. Step 1

    Fork the starter

    greeting-kit already has commits for greet. This copies that history into your fork.

  2. Step 2

    Start the feature branch

    The change is a farewell function next to greet.

  3. 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; }

  4. Step 4

    Stage and commit

    First commit of the feature.

  5. Step 5

    Save the feature

    The graph on your fork grows. greeting-kit does not.

  6. Step 6

    Mention it in the README

    Add this sentence in README.md: farewell(name) returns a goodbye.

  7. Step 7

    Commit the note

    Run git add README.md, then this commit.

  8. Step 8

    Open the pull request

    The request proposes add-farewell into greeting-kit main. Reviewer comments appear after it opens.

  9. Step 9

    Address the review

    Change farewell so it returns Goodbye, name with an exclamation point. Keep greet as it was.

  10. Step 10

    Commit the follow-up

    Run git add greet.js, then this commit. origin/main then moves and will conflict.

  11. Step 11

    Fetch the new main

    Fetch records origin/main. Your branch does not move.

  12. 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".

  13. Step 13

    Update local main

    The pull request merges when main contains the feature.

  14. Step 14

    Merge the feature

    This brings add-farewell into main.

  15. Step 15

    Publish the merge

    A teammate pulls this main as soon as the push finishes. After this, reset would throw their copy away.

  16. 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.

  17. Step 17

    Push the revert

    This push is a fast-forward. The bad commit stays in the history.

  18. 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.

Follow the steps. Each command step can be placed in the terminal. Edit files in the editor, then stage them.
Supported command reference
  • init
  • add <path> | add .
  • commit -m "message" | commit --amend -m "message"
  • status
  • diff | diff --staged
  • log | log --oneline | log --graph | log --oneline --graph
  • show [ref]
  • branch | branch <name> | branch -d <name>
  • checkout <ref> | checkout -b <name> | switch <name> | switch -c <name>
  • merge <branch>
  • rebase <branch> | rebase -i <branch> | rebase --edit-todo <pick|drop|reword> <hash> [message] | rebase --continue | rebase --abort
  • cherry-pick <ref>
  • reset --soft <ref> | reset --mixed <ref> | reset --hard <ref>
  • revert <ref>
  • stash | stash list | stash pop | stash apply
  • restore <path> | restore --staged <path>
  • remote | remote add <name> <repo-slug>
  • clone <repo-slug> | git clone <repo-slug> | git fork <repo-slug>
  • fetch [remote] | pull [remote] [branch] | push [remote] [branch] | push --force [remote] [branch]
  • blame <path>
  • reflog
  • tag | tag <name> [ref] | tag -d <name>
  • bisect start | bisect good [ref] | bisect bad [ref] | bisect reset
  • config <key> <value> | config --list
  • write <path> <text> (workbench: edit the working tree)
  • issue new "title" | pr new <source> <target> "title" | review "comment" | review --request-changes "comment"

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.
Open a fresh playground