Skip to content

Commit 2656fb1

Browse files
nasamuffingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5ef811a commit 2656fb1

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

Documentation/MyFirstContribution.txt

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ the mirror on GitHub.
3535

3636
----
3737
$ git clone https://github.com/git/git git
38+
$ cd git
3839
----
3940

4041
[[identify-problem]]
@@ -164,8 +165,28 @@ $ ./bin-wrappers/git psuh
164165

165166
Check it out! You've got a command! Nice work! Let's commit this.
166167

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+
167188
----
168-
$ git add Makefile builtin.h builtin/psuh.c git.c
189+
$ git add Makefile builtin.h builtin/psuh.c git.c .gitignore
169190
$ git commit -s
170191
----
171192

@@ -211,7 +232,8 @@ on the reference implementation linked at the top of this document.
211232
It's probably useful to do at least something besides printing out a string.
212233
Let's start by having a look at everything we get.
213234

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:
215237

216238
----
217239
int i;
@@ -243,7 +265,7 @@ function body:
243265

244266
...
245267

246-
git_config(git_default_config, NULL)
268+
git_config(git_default_config, NULL);
247269
if (git_config_get_string_const("user.name", &cfg_name) > 0)
248270
printf(_("No name is found in config\n"));
249271
else
@@ -315,6 +337,7 @@ Run it again. Check it out - here's the (verbose) name of your current branch!
315337
Let's commit this as well.
316338

317339
----
340+
$ git add builtin/psuh.c
318341
$ git commit -sm "psuh: print the current branch"
319342
----
320343

@@ -366,6 +389,7 @@ see the subject line of the most recent commit in `origin/master` that you know
366389
about. Neat! Let's commit that as well.
367390

368391
----
392+
$ git add builtin/psuh.c
369393
$ git commit -sm "psuh: display the top of origin/master"
370394
----
371395

@@ -418,7 +442,6 @@ OUTPUT
418442
------
419443
...
420444

421-
422445
GIT
423446
---
424447
Part of the linkgit:git[1] suite

0 commit comments

Comments
 (0)