git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] doc: add some nit fixes to MyFirstContribution

From
Emily Shaffer <emilyshaffer@google.com>
Date
May 29, 2019, 20:18 UTC
Message-ID
<20190529201809.169065-1-emilyshaffer@google.com>
In-Reply-To
<20190517190359.21676-1-emilyshaffer@google.com>

A trial run-through of the tutorial revealed a few typos and missing commands in the tutorial itself. This commit fixes typos, clarifies which lines to keep or modify in some places, and adds a section on putting the git-psuh binary into the gitignore.

Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
---
This patch is based on next, as the doc hasn't made it to master yet.
- Missing `cd git` after cloning the repo
- Documented how to add git-psuh to the gitignore
- Documented the need to leave prior printfs in place during the
  tutorial
- Typos: missing ;, stray newline
- Missing `git add builtin/psuh.c` in a couple of places; this could
  also have been done by adding the filename to the end of the commit
  call, but I don't think that's a good habit (as opposed to staging all
  changes, inspecting the wt state, and then committing). Open for
  debate.
Big thanks to Christian for the trial run and review.
 - Emily
 Documentation/MyFirstContribution.txt | 31 +++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/Documentation/MyFirstContribution.txt b/Documentation/MyFirstContribution.txt
index 274df8575b..895b7cfd4f 100644
--- a/Documentation/MyFirstContribution.txt
+++ b/Documentation/MyFirstContribution.txt
@@ -35,6 +35,7 @@ the mirror on GitHub.
 
 ----
 $ git clone https://github.com/git/git git
+$ cd git
 ----
 
 [[identify-problem]]
@@ -164,8 +165,28 @@ $ ./bin-wrappers/git psuh
 
 Check it out! You've got a command! Nice work! Let's commit this.
 
+`git status` reveals modified `Makefile`, `builtin.h`, and `git.c` as well as
+untracked `builtin/psuh.c` and `git-psuh`. First, let's take care of the binary,
+which should be ignored. Open `.gitignore` in your editor, find `/git-push`, and
+add an entry for your new command in alphabetical order:
+
+----
+...
+/git-prune-packed
+/git-psuh
+/git-pull
+/git-push
+/git-quiltimport
+/git-range-diff
+...
+----
+
+Checking `git status` again should show that `git-psuh` has been removed from
+the untracked list and `.gitignore` has been added to the modified list. Now we
+can stage and commit:
+
 ----
-$ git add Makefile builtin.h builtin/psuh.c git.c
+$ git add Makefile builtin.h builtin/psuh.c git.c .gitignore
 $ git commit -s
 ----
 
@@ -211,7 +232,8 @@ on the reference implementation linked at the top of this document.
 It's probably useful to do at least something besides printing out a string.
 Let's start by having a look at everything we get.
 
-Modify your `cmd_psuh` implementation to dump the args you're passed:
+Modify your `cmd_psuh` implementation to dump the args you're passed, keeping
+existing `printf()` calls in place:
 
 ----
 	int i;
@@ -243,7 +265,7 @@ function body:
 
 ...
 
-	git_config(git_default_config, NULL)
+	git_config(git_default_config, NULL);
 	if (git_config_get_string_const("user.name", &cfg_name) > 0)
 		printf(_("No name is found in config\n"));
 	else
@@ -315,6 +337,7 @@ Run it again. Check it out - here's the (verbose) name of your current branch!
 Let's commit this as well.
 
 ----
+$ git add builtin/psuh.c
 $ git commit -sm "psuh: print the current branch"
 ----
 
@@ -366,6 +389,7 @@ see the subject line of the most recent commit in `origin/master` that you know
 about. Neat! Let's commit that as well.
 
 ----
+$ git add builtin/psuh.c
 $ git commit -sm "psuh: display the top of origin/master"
 ----
 
@@ -418,7 +442,6 @@ OUTPUT
 ------
 ...
 
-
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
2.22.0.rc1.257.g3120a18244-goog
Previous: Emily Shaffer
Message 44 of 44 in “documentation: add lab for first contribution”
  1. 0/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 11, 2019
  2. 1/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 11, 2019
  3. Junio C HamanoApr 12, 2019
  4. Emily ShafferApr 12, 2019
  5. Junio C HamanoApr 13, 2019
  6. Emily ShafferApr 15, 2019
  7. Josh SteadmonApr 11, 2019
  8. Junio C HamanoApr 12, 2019
  9. Emily ShafferApr 12, 2019
  10. 0/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 16, 2019
  11. 1/1 documentation: add lab for first contributionEmily Shaffer via GitGitGadget, Apr 16, 2019
  12. Junio C HamanoApr 17, 2019
  13. Eric SunshineApr 17, 2019
  14. Junio C HamanoApr 18, 2019
  15. Emily ShafferApr 17, 2019
  16. Emily ShafferApr 16, 2019
  17. documentation: add lab for first contributionEmily Shaffer, Apr 19, 2019
  18. Junio C HamanoApr 21, 2019
  19. Emily ShafferApr 22, 2019
  20. documentation: add tutorial for first contributionEmily Shaffer, Apr 23, 2019
  21. Josh SteadmonApr 30, 2019
  22. Emily ShafferMay 2, 2019
  23. Phil HordMay 3, 2019
  24. Emily ShafferMay 7, 2019
  25. Jonathan TanMay 6, 2019
  26. Emily ShafferMay 7, 2019
  27. Jonathan TanMay 7, 2019
  28. Junio C HamanoMay 8, 2019
  29. 0/2 documentation: add lab for first contributionEmily Shaffer, May 7, 2019
  30. 1/2 documentation: add tutorial for first contributionEmily Shaffer, May 7, 2019
  31. Emily ShafferMay 7, 2019
  32. Junio C HamanoMay 8, 2019
  33. Emily ShafferMay 8, 2019
  34. Jonathan TanMay 8, 2019
  35. 2/2 documentation: add anchors to MyFirstContributionEmily Shaffer, May 7, 2019
  36. Junio C HamanoMay 8, 2019
  37. 0/2 documentation: add tutorial for first contributionEmily Shaffer, May 17, 2019
  38. 1/2 documentation: add tutorial for first contributionEmily Shaffer, May 17, 2019
  39. Christian CouderMay 26, 2019
  40. Emily ShafferMay 29, 2019
  41. SZEDER GáborOct 18, 2019
  42. Emily ShafferOct 18, 2019
  43. 2/2 documentation: add anchors to MyFirstContributionEmily Shaffer, May 17, 2019
  44. doc: add some nit fixes to MyFirstContributionEmily Shaffer, May 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.