munotes®

The GitHub Repository

Get access to whole semester resourcesSemester Pass

Chapter Seventy-Two

Syllabus topic Module 2, "Final Deliverables at the End of Module 2: GitHub Repository".

Pages 472 to 476 of 499

In one line

The repository is the only deliverable an examiner can inspect without you in the room, and it answers three questions at a glance: does it run, did the whole team build it, and is anything in it that should not be.

In the wording to use when asked: the repository is the version-controlled record of the project, presented as a deliverable; it is assessed on whether the working system can be obtained and run from it, on what its commit history shows about how the work was done and by whom, and on the absence of secrets, generated files and material that does not belong in version control.

What an examiner opens, in order

They look atIt tells them
1the READMEwhether this can be run at all, in the first minute (Chapter 69)
2the file listwhether the project is organised, and whether .env or a key is sitting there
3the commit historywhether four people worked, over weeks, or one person worked over one weekend
4the contributorsthe same question, counted
5the issueswhether defects were tracked or remembered (Chapter 56)
6the pull requestswhether anybody read anybody else's code (Chapter 62)
7the releases and tagswhich commit the report and the demonstration describe

That order matters. The README decides the mood of everything after it, which is why Chapter 69 spends a chapter on a file that takes an hour to write.

The history is the evidence, and it cannot be faked at the end

A commit history records dates, sizes and authors, and those three together say how a project was built. An examiner does not need to read the diffs to see:

  • four people or one. Four names, each with commits in their own area and some outside it.
  • weeks or a weekend. Commits spread through September and October, or two hundred on 24 October.
  • built side by side or in sequence. The worked history alternates between public/ and src/ from 11 September, which is what the guide remarked on at the code review without being told (Chapter 49).
  • tested as it went. Tests appearing in the same commits as the code they test, not in one commit at the end.

Nothing here can be arranged in the last week, and that is the point. Commit as you work, and the evidence writes itself.

Commits must carry real names and emails

Chapter 39 set user.name and user.email on each machine, once, and this is where that pays. If a member never set them, their commits are attributed to whatever their computer's account happens to be called, and the repository then shows three contributors, or four names that nobody can match to the team.

munotes.in472

The GitHub Repository

git shortlog is the command that answers it, and it is what GitHub's contributors list is built from:

$ rm -rf ~/who-wrote-it; mkdir ~/who-wrote-it && cd ~/who-wrote-it
$ git init -q
$ git -c user.name="Aditi Kulkarni" -c user.email="aditi@college.example" \
    commit -q --allow-empty -m "Add the README"
$ git -c user.name="Farhan Shaikh" -c user.email="farhan@college.example" \
    commit -q --allow-empty -m "Take an order's stock in one update"
$ git -c user.name="Sneha Patil" -c user.email="sneha@college.example" \
    commit -q --allow-empty -m "Draw the counter's list"
$ git -c user.name="Rohan Deshmukh" -c user.email="rohan@college.example" \
    commit -q --allow-empty -m "Limit failed sign-ins"
$ git -c user.name="Farhan Shaikh" -c user.email="farhan@college.example" \
    commit -q --allow-empty -m "Give back a cancelled order's stock"
$ git --no-pager shortlog -sne HEAD
     2	Farhan Shaikh <farhan@college.example>
     1	Aditi Kulkarni <aditi@college.example>
     1	Rohan Deshmukh <rohan@college.example>
     1	Sneha Patil <sneha@college.example>

Two things to read in that answer: every author is a person, with a college address, and the counts are not one person's project with three names attached. Run it on your own repository in week 13, and if a name is wrong, fix the setting on that machine and say so; a wrong name cannot be corrected in the history without rewriting it, which is worse.

Say HEAD, as that command does. With nothing to count, git shortlog reads its standard input, expecting git log's output to be piped in, and in a script or anywhere without a terminal it therefore prints nothing at all and looks like a repository with no authors. It was written here without HEAD first, and that is exactly what it did.

Nothing in it that should not be there

This is the part that costs marks, and occasionally more than marks:

Must never be committedWhyWhere it is handled
.envit holds the database password.gitignore, printed in Chapter 39
a keystore, .jks, a signing keywhoever has it can sign an app as you.gitignore, and Chapter 59
node_modules/thousands of files that npm ci recreates exactly.gitignore
build output: android/build/, app/build/, *.loggenerated, large, and always stale.gitignore
a database dump with real people in itit is their data, not yoursseeded data instead (Chapter 68)
a password or key pasted into codeit is in the history for eversettings from the environment (Chapter 28)
screenshots of somebody's messages, a CV, a resume, holiday photosit happens, from git add .add by path, never by dot

Three commands to run before you submit, on your own repository:

git ls-files | grep -Ei '(^|/)\.env$|\.jks$|\.keystore$|^node_modules/'
git log --all --diff-filter=A --name-only --format= | sort -u | grep -Ei 'secret|password|\.env|key'
git count-objects -vH | grep size-pack
munotes.in473

The GitHub Repository

The first lists forbidden files that are tracked now; the second lists every file ever added in the history, which is where a secret committed in week 3 and deleted in week 4 still lives; the third says how large the repository is, and a size in tens of megabytes usually means node_modules or a build folder went in at some point.

If a password was ever committed, change the password. Deleting the file does not remove it from the history, and rewriting history on a shared repository breaks everybody's clone. Changing the secret is the only fix that works, and saying so in the report's limitations is better than hoping.

Making it openable by the examiner

A repository the examiner cannot open counts for nothing, and this is a decision, not an accident. The worked repository was private all semester, with the four members as collaborators, which is the right default for student work. Before the examination the team had three choices:

ChoiceWhat it means
1Make it publicanyone can read it; simplest, and what most colleges expect. Check first that no secret was ever committed
2Add the examiner as a collaboratorneeds their GitHub account name, which you rarely have in advance
3Keep it private and show it from your laptopworks in the room, proves nothing afterwards

Ask your guide which the college wants, in week 13, with the other submission questions (Chapter 70). Whatever you choose, put the repository's address in the report, on the certificate page or the first page, where it cannot be missed.

The release, and what the tag is for

Chapter 62 tagged the submitted version v1.0 and published it as a release with the APK attached. Two reasons that is worth the five minutes:

  • The report describes one version, and the tag names it. Without a tag, "the submitted code" is whatever main happens to be when the examiner looks, which may be three commits later.
  • The examiner can download the app that was demonstrated, rather than trusting that the APK on your phone came from this code.

The repository review, before you submit

CheckExpected
1Clone into an empty folder and follow the READMEa running system, and /api/health answers
2npm test on that clone117 tests, 0 failed
3git shortlog -sne HEADevery member, with a real name and a college address
4git log --oneline --format='%ad %an' --date=shortwork spread across weeks, not one night
5Branchesmerged and deleted; nothing half-finished left on main
6Issuesthe defects you found, closed, with the commit that fixed each
7Pull requestsreviewed by somebody other than the author
8The forbidden-file commands abovenothing found
9Tag and releasev1.0 on the submitted commit, with the APK attached
10The README's link and the report's linkthey point at each other
munotes.in474

The GitHub Repository

Do this for your project

  1. Create the repository in week 1, private, with the whole team as collaborators.
  2. Set user.name and user.email on every machine before the first commit.
  3. Commit as you work, in small commits that name what changed; never git add ..
  4. Keep .gitignore honest from the first day; .env and keys never go in.
  5. Use branches and pull requests, so the history shows that code was read.
  6. Track defects as issues and close them with the commit that fixes them.
  7. Run the ten-line review above before you submit, and the three forbidden-file commands with it.
  8. Tag the submitted version, publish a release, attach the APK, and put the address in the report.

Mistakes that cost marks

One member committing everything, because the others sent their files by chat.

Two hundred commits on one day, all named "update".

git add ., which is how .env, a keystore and somebody's photographs get committed.

node_modules/ in the repository, which makes it enormous and says the team did not know what a lock file is for.

A private repository with no way in, discovered on the examination day.

No tag, so nobody can say which commit the report describes.

A README that does not work, which undoes the good impression of everything else.

Quick revision

  • An examiner reads, in order: README, file list, history, contributors, issues, pull requests, releases.
  • The history shows how many people, over how long, and whether tests came with the code; it cannot be arranged at the end.
  • git shortlog -sne HEAD is the contributors list: every member, real name, college address (git config, Chapter 39); without HEAD it reads standard input and prints nothing.
  • Never committed: .env, keys and keystores, node_modules/, build output, real people's data, secrets in code.
  • A secret ever committed means change the secret; deleting the file is not a fix.
  • Decide how the examiner opens it, and put the address in the report.
  • Tag the submitted commit, publish a release, attach the APK.

Questions you must be able to answer

1. Why is the repository assessed and not just the code inside it? Because it is the only deliverable that can be inspected without the team present, and because how the work was done is part of what is being taught: the history shows who built what, over what period, and whether code was read and defects tracked.

munotes.in475

The GitHub Repository

2. What can an examiner tell from a commit history without reading a single diff? How many people worked, over how many weeks, in which parts of the system, whether tests arrived with the code they test, and whether the work was continuous or done in one burst at the end.

3. Why must every machine set user.name and user.email before the first commit? Because those two values are recorded in every commit and are what the contributors list is counted from. A member who never set them appears under whatever their computer's account is called, or not as themselves at all, and the history cannot be corrected afterwards without rewriting it.

4. What must never be in the repository, and what do you do if a password was committed? Settings files with real passwords, signing keys and keystores, installed packages, build output, real people's data, and secrets pasted into code. If a password was ever committed, change the password: it remains in the history even after the file is deleted, and rewriting a shared history breaks every clone.

5. Why tag the submitted version? So that the report, the demonstration and the code can be shown to be the same thing. Without a tag, "the submitted code" is whatever the main branch holds when somebody looks.

6. How should the examiner get access to a private student repository? By a decision made in advance with the guide: make it public after checking that no secret was ever committed, or add the examiner as a collaborator, and either way print its address in the report. Leaving it private with no arrangement is the same as having no repository.

munotes.in476

The rest of this subject

These notes are cut from the University's printed syllabus. Open the syllabus itself for the same subject.

Issue
Done!