Skip to content
slaterslater edited this page Oct 13, 2020 · 102 revisions

Lab 3

Due Date

Friday Oct 9 by Midnight.

Overview

This week we are going to practice using git to manage multiple simultaneous changes, and git merges. To do this we'll continue to add some features to our link checker repos. This lab will help you practice the following:

  • creating branches to work on new features and fix bugs
  • working on code changes in parallel
  • adding features to existing code
  • using git merge
  • fixing merge conflicts
  • how to find and identify commits on GitHub

Step 1. Pick your Features

You are going to make changes to your repo. Pick at least 2 of the following features to add to your project:

  1. Make sure the program honours the CLICOLOR environment variable. If CLICOLOR=1 is set, the program can use colours in the output. If CLICOLOR=0 is set, do not output any colour.
  2. Make sure that the program exits with an appropriate error code. If there are no errors (all links are good), exit with 0. Otherwise, exit with a non-zero exit code.
  3. Add a -j, --json, and/or \j flag, which causes the program to output JSON. The JSON output should look like [ { "url": 'https://www.google.com', "status": 200 }, { "url": 'https://bad-link.com', "status": 404 } ]
  4. Support --all, --good, and --bad flags. The --all flag is the default, and if none of these are present, it will display good and bad URLs. The --good flag causes only good URLs to get displayed; the --bad flag causes only bad URLs to get displayed.

In your project's GitHub repo, file Issues for each of the features, and discuss the changes you will make.

Step 2. Create Topic Branches

For each of your features, create a new branch. For example, if you filed Issue #10 and Issue #11 you need to create 2 new branches off of master:

$ git checkout -b issue-10 master
$ git checkout -b issue-11 master

All work for Issue #10 should happen on the issue-10 branch. All work for Issue #11 should happen on the issue-11 branch.

None of your work should happen on master! All work should be done on one of the topic branches you just made.

Step 3. Implement Your Features

Throughout the week work on your two features. You are free to discuss strategies and ideas with your classmates, but you must do your own work in the respective branches you created above (no pull requests this time, sorry!).

Your two features will likely involve modify the same code. This is fine and to be expected. Resist the desire to share any code between branches! Keep all work for each feature in its own topic branch, and touch as little code as possible in each branch.

You can work on the features one after the other, or in parallel. With software, it's common and often helpful to do more than one thing at a time: if you get stuck on one, you can switch to the other.

Step 4. Merge You First Feature Branch

When you have completed both features, and each branch contains the necessary code, it's time to merge.

Switch to your master branch and merge the first feature branch (e.g., issue-10):

$ git checkout master
$ git merge issue-10

This merge should go smoothly, and assuming you haven't changed anything on master since you created your branches, git will do a fast-forward merge. Confirm that it did. If it didn't, determine why not.

Step 5. Merge You Second Feature Branch

After you've merged your first branch, it's time to merge the second (e.g., issue-11) into master:

$ git checkout master
$ git merge issue-11

This merge will likely require a three-way recursive merge, since git can't fast-forward your master branch. You may also need to deal with merge conflicts.

Make sure you fix any/all merge conflicts before you complete the merge.

When you're done, the master branch should contain the code for both feature branches, and both features should be working. Make sure your merges didn't break anything!

Test, test, test, and test again. Is the master branch still working? Do you need to fix anything before going to the next step? If so, commit to master to correct the problem(s). Keep track of this, and discuss in your blog below.

Step 6. Push your Master Branch to GitHub

Push your fully merged and tested master branch to GitHub:

$ git push origin master

Step 7. Close your Issues

Close your original issues, and provide a link in the comments to the merge commit on GitHub that closes the feature. On GitHub the URL for a commit follows this format:

https://github.com/username/project-name/commit/commit-sha

For example, the ddeaf180 commit for this repo is at:

https://github.com/Seneca-CDOT/topics-in-open-source-2020/commit/ddeaf180bcde5ebed04b695453fa52cf6b410aca

When you close your issue, add a comment like this:

Closed by https://github.com/Seneca-CDOT/topics-in-open-source-2020/commit/ddeaf180bcde5ebed04b695453fa52cf6b410aca

Step 8. Write a Blog Post

Write a blog post about the process of working in parallel branches in your project. In your post, include links to everything you discuss (e.g., the project repo, your issues, your merge commits).

Discuss what you did, the changes you made for your features, and the process of doing your merges. What problems did you have? What did you learn? What would you do differently next time?

Submission

When you have completed all the requirements above, please add your details to the table below.

Name Blog Post (URL) Issues URLs Merge Commit URLs
Example Name https://example.com/blog/1 10, 11 ddeaf180, 10b146ff
Chris Pinkney https://dev.to/chrispinkney/merging-makes-the-spice-flow-4be6 19, 21 f3cd3bb, 57829ef
Eunbee Kim https://ekim105.wordpress.com/2020/10/06/branch-merge/ 09, 10 f84d593, 685bb8a
Matthew Stewardson https://matthew-k-stewardson.blogspot.com/2020/10/week-4-lab-3.html#more 11 12 7501097 34d6383
Plamen Velkov https://plamenvelkovtech.blogspot.com/2020/10/the-merge-conflicts-of-life.html 12, 13 047f007, 7524089
Ekaterina Grinberg https://medium.com/@egrinberg/lab-3-dps909-a8cf8861fc41 4, 5 00f2e72,e9e8c02
Mohammed Niaz Ul Haque https://dev.to/niazulhaque/hacktober-updates-did-a-three-way-recursive-merge-3onc 14, 15 d6ed1c, e255d4
Michael Brackett https://dev.to/mljbrackett/osd600-lab3-4le5 5, 6 29b2563, 2e506df
Roger Yu https://ryudeveloper.wordpress.com/2020/10/07/lab-3-the-benefits-of-git/ 9, 10 6f8a25f6, 0561e2c9
Tim Roberts https://dps909tddr.tech.blog/lab-3-mix-master-merge/ 9, 10 511cebf, 7f549e4
Philip Golovin https://1jz.tech.blog/2020/10/07/merge-conflicts-can-git-out-of-my-face/ 13, 14 b9f208b, 661b7b7
Kimin Lee https://dev.to/klee214/added-new-features-to-findbreakurl-cli-program-ijl 7, 8 145fb45, 2dc664c
Junyong Liu https://jliu396.blogspot.com/2020/10/osd-lab3-git-merge.html 5, 6 43852db, c3af227
Khoi Nguyen Vu (Tony) https://medium.com/@tonyknvu/git-merge-succeeded-wait-which-branch-i-am-on-again-omg-not-master-git-reset-a2c5f56969a8 8 , 9 a5ed9a0 , c64d283
Thanh Tien Phat Nguyen https://dev.to/phast184/new-branches-growing-from-the-tree-2g3n 8, 9 8ea03cc, 12c3da6
Joel Azwar https://joelazwaros.blogspot.com/2020/10/journeying-through-git-merging.html 11, 12 8ed9611, 139ba35
Jie Yang https://jyangblogs.wordpress.com/2020/10/08/how-to-fix-a-conflict-when-merge-a-git-commit/ 11, 12 47394cd, 51590b2
Jennifer Croft https://dev.to/strawberries73/osd600-lab-3-2-more-features-kg8 5, 6 7acf23a, 5e6bd29
Hyunji Lee https://hyunjijanelee.blogspot.com/2020/10/lab3-add-features.html 10, 11 8c7bd73, 83e84fd
Joseph (Joey) Assal https://osd600-joey-assal.blogspot.com/2020/10/osd600-lab-3.html 9, 10 027124f, 7709247
Mintae Kim https://mintaedotblog.wordpress.com/2020/10/09/lab3-add-new-features-with-multiple-branches/ 6, 8 94d5c87, 9d0e064
Thomas-Jayrell LeBlanc https://tjstavern24697521.wordpress.com/2020/10/08/lab-3-merging/ 5, 4 290712e, 3cb8afa
Paul Sin https://osd600.blogspot.com/2020/10/lab-3.html 9, 10 7c7ce96, 6576cf1
Royce Ayroso-Ong https://medium.com/@roycedev/merging-it-all-together-6309329c8ff8 12, 13 a15b818, 4b72f6a
Abdulbasid Guled https://dev.to/hyperthd/lab-3-why-make-prs-when-you-can-just-merge-everything-together-54g6 4, 5 b10e5e4, 6d19820
Yuan-Hsi Lee https://dev.to/yuanleemidori/resolving-conflict-2ch5 issue #11 and issue #12 5329c and 53727
Nesa Bertanico https://nesabyte.wordpress.com/2020/10/09/happily-ever-after-merging/ 11 , 12 e224a26 5054ef1
Minh Huy Nguyen https://x7z.net/lab03 8, 9 a14e3c2, 93cdeec
Nathan Pang https://osdnathanp.wordpress.com/2020/10/09/lab-3/ 9, 10 9d2cc5e4, d2b8aae3
Ruby Anne Bautista https://medium.com/@rabautista/decluttering-the-desktop-7f10c19b350b 4, 5 d4888d3, c49a52b
Wei Huang https://weihuangosd.blogspot.com/2020/10/merging-branches.html 12, 13 8775371, 6f4b9f0
Leon Li https://gonewiththewind1982.blogspot.com/2020/10/study-git-merge-in-lab3.html 8, 9 22e6937, 286f97c, a9ce692
Stella Jung https://sostellajung.blogspot.com/2020/10/how-to-handle-conflicts-of-git.html 8, 9 ee731f1, 4781c5f
Jongwon Jang https://jongwon-jang.blogspot.com/2020/10/w4-lab-3.html 5, 6 9869105, b5224c2
Bing Pan https://dev.to/bpan2/eclipse-wsl-2-git-37lf 4, 5 936c08c6, ce0ebcb7
Badal Sarkar https://badalsarkar.ca/blog-opensource/opensource/Working-in-git-branch/ 4, 5 fa17345, 5953c58
Mohammed Ahmed (Mo) https://medium.com/@moho472/lab-3-tree-err-git-branches-7495e2ea8e68 Issue 8,Issue 9 609716c , f75d9c5
Matthew Ross Now Featuring! - Lab 3 12, 13 8af7f5c, bf3ae26
Sanjida Afrin https://medium.com/@safrin2/not-a-fan-of-conflict-51e055303a90 20, 21 8b2f11f, 8ab33eb
Abu Zayed Kazi https://www.abuzayed.ca/my-blog/osd600/2020/10/10/lab-3-merging-branches-in-github/ 16, 17 2020fc1, 1a14fbc
Henry Nguyen https://dev.to/henryzerocool/parallel-features-with-git-1m8e 5, 6 acede5, 13108c
Anthony Slater https://dev.to/slaterslater/adding-flag-support-to-gustavo-3aph 3, 5 90599bc,  75da8d9
Jianpeng Zhang https://damontui.blogspot.com/2020/10/week4lab3.html 6, 5 89e5486,  99aa38d
Zongwei Yang https://dev.to/yzwdroid/conflict-resolved-4gbe 5, 6 c034e12, 081c227
Pedro Antonio Fonseca Ferreira https://medium.com/@pedrofonsecadev/working-on-parallel-branches-749a90e2e8b9 3, 4, 5 0c7f27da, 6b5ed4cf
Zong Jin Jiang https://zjjiang2.blogspot.com/2020/10/lab-3-blog.html 11,12 ac42f85,02b2b9b
Isabella Liu https://dev.to/isabellaliu77/merge-branches-into-master-1jg3 8, 9 795dea5, fa2a44a
Mamadou Diallo https://mamadou--diallo.blogspot.com/2020/10/creating-features-and-adding-them.html 8, 7 4f2bd11, 9244790
Abdul Abdi https://abdulosd.blogspot.com/2020/10/separatebrances.html 4, 5 ca77f96, a75a535
Jasper Mui https://muioverflow.wordpress.com/2020/10/12/adding-more-feature-to-me-check-links/ 8, 9 154c7aa, ac280d8
Raymond Rambo https://dev.to/fluentinstroll/link-checker-release-0-2-0-5970 5, 6 97653e5, 1fd0bfe
Devansh Shah https://dev.to/zg3d/working-with-branches-adding-features-4ne9 dfed9bf, 86d1ede
Palak Chawla https://palak-chawla.blogspot.com/2020/10/lab-3-life.html 9, 11 63895ca, 1f6ecd9
Muskan Shinh https://muskanshinh.wordpress.com/2020/10/13/lab-3/ 4, 5 6fb7a18, 5778dfd
Clone this wiki locally