doc: add some nit fixes to MyFirstContribution
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Emily Shaffer committed
May 29, 2019 at 13:18 UTC
2656fb16ddb1ea1717277bcdf981c5e8794bfb5b
1 file changed
+27
-4
Documentation/MyFirstContribution.txt
+27
-4
@@ -35,6 +35,7 @@ the mirror on GitHub.
35
36
----
37
$ git clone https://github.com/git/git git
38
+$ cd git
39
----
40
41
[[identify-problem]]
@@ -164,8 +165,28 @@ $ ./bin-wrappers/git psuh
165
166
Check it out! You've got a command! Nice work! Let's commit this.
167
168
+`git status` reveals modified `Makefile`, `builtin.h`, and `git.c` as well as
169
+untracked `builtin/psuh.c` and `git-psuh`. First, let's take care of the binary,
170
+which should be ignored. Open `.gitignore` in your editor, find `/git-push`, and
171
+add an entry for your new command in alphabetical order:
172
+
173
+----
174
+...
175
+/git-prune-packed
176
+/git-psuh
177
+/git-pull
178
+/git-push
179
+/git-quiltimport
180
+/git-range-diff
181
+...
182
+----
183
+
184
+Checking `git status` again should show that `git-psuh` has been removed from
185
+the untracked list and `.gitignore` has been added to the modified list. Now we
186
+can stage and commit:
187
+
188
----
168
-$ git add Makefile builtin.h builtin/psuh.c git.c
189
+$ git add Makefile builtin.h builtin/psuh.c git.c .gitignore
190
$ git commit -s
191
----
192
@@ -211,7 +232,8 @@ on the reference implementation linked at the top of this document.
232
It's probably useful to do at least something besides printing out a string.
233
Let's start by having a look at everything we get.
234
214
-Modify your `cmd_psuh` implementation to dump the args you're passed:
235
+Modify your `cmd_psuh` implementation to dump the args you're passed, keeping
236
+existing `printf()` calls in place:
237
238
----
239
int i;
@@ -243,7 +265,7 @@ function body:
265
266
...
267
246
- git_config(git_default_config, NULL)
268
+ git_config(git_default_config, NULL);
269
if (git_config_get_string_const("user.name", &cfg_name) > 0)
270
printf(_("No name is found in config\n"));
271
else
@@ -315,6 +337,7 @@ Run it again. Check it out - here's the (verbose) name of your current branch!
337
Let's commit this as well.
338
339
----
340
+$ git add builtin/psuh.c
341
$ git commit -sm "psuh: print the current branch"
342
----
343
@@ -366,6 +389,7 @@ see the subject line of the most recent commit in `origin/master` that you know
389
about. Neat! Let's commit that as well.
390
391
----
392
+$ git add builtin/psuh.c
393
$ git commit -sm "psuh: display the top of origin/master"
394
----
395
@@ -418,7 +442,6 @@ OUTPUT
442
------
443
...
444
421
-
445
GIT
446
---
447
Part of the linkgit:git[1] suite