Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] WIP: doc: add new git tutorial
@ 2026-10-06 19:37 Julia Evans via GitGitGadget
  2026-10-06 19:37 ` [PATCH 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Julia Evans via GitGitGadget @ 2026-10-06 19:37 UTC (permalink / raw)
  To: git; +Cc: Julia Evans

This is the first draft of a tutorial which introduces Git in two parts:

Part 1: Create an empty repo & make 2 commits (git init, git add, git
commit, git status, git diff) Part 2: Push the repo to a remote host like
GitHub or GitLab (git remote add, git push)

So far we've gotten 112 comments from 22 beta testers who have tried to
learn Git for the first using this tutorial. Most of them were able to
finish it successfully. I'd like to avoid getting into the details of every
single thing in the tutorial at this stage (we're still planning to do a
second round of feedback with the beta testers, and the beginning especially
will likely change)

There are 2 questions I'd like feedback on since they both could affect the
structure of the tutorial. I don't think either of these is a dealbreaker,
since folks generally were able to finish the tutorial despite all these
issues and said that they enjoyed it and learned a lot. But it would be
great if there were an easy way to make the process less messy.


question 1: create the repo on the command line, or in the forge?
=================================================================

One issue that came up a lot in our testing is that the tutorials explains
how to run git init in a repo to create it locally and then later choose a
forge to host that repo (GitLab, GitHub, etc) and push to the remote on that
forge.

Several users ran into the issue that GitLab by default creates a README.md,
which means that when you run your first git push, the push fails since
there's already a commit.

A few options I see:

a. Suggest that they instead create the repo on the forge and then clone it.
I think this is easier and usually I support suggesting things that are
easier, but in this case I think it's our role (as the official Git
documentation) to make it clear that you do not need a forge to use Git. IMO
this approach really confuses that issues and makes it seem like the forge
is more important than it is. b. Suggest git push --force. This is an easy
fix but I don't like suggesting that people use --force so early since it's
so dangerous. c. Just try to get users to try to figure the right way in the
GitLab/GitHub/etc UI to actually create an empty repository that it's
possible to just push to. This is really hard because the UIs constantly
change.


current solution 1
==================

Right now we're working on Option C since it seems least bad


question 2: How to handle authentication
========================================

 * How should the tutorial tell users to authenticate? I know there are
   commands like gh auth login for GitHub and IIRC GitLab and it seems like
   there are some advantages to using those, but also AFAIK they're all
   pretty specific to the individual Git forge and I don't see how it's
   possible to discuss them in a generic tutorial.
 * Whether to explain the process of creating an SSH key etc. Arguably this
   is the job of the SSH documentation, but since https://www.openssh.org/
   doesn't have such a guide, it feels bad to tell users "you should go read
   a guide on how to use SSH to do this but by the way that guide does not
   exist so good luck I guess".
 * A lot of testers found it hard to find the SSH URL on GitLab/GitHub


current solution 2
==================

Right now we're solving these by:

 1. Using SSH
 2. Explaining how to set up SSH in the easiest way possible (with
    disclaimers to check your security team's policy if applicable since the
    "easiest way" may not be the best)
 3. Giving some instructions for how to translate an HTTPS URL to an SSH URL

Julia Evans (2):
  doc: remove gittutorial
  doc: add new Git tutorial for beginners

 Documentation/gittutorial.adoc | 854 +++++++++++++++------------------
 1 file changed, 397 insertions(+), 457 deletions(-)


base-commit: 5a7d1e8045ce66c908f62598e26cbb8df7b39a90
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2248%2Fjvns%2Fgit-tutorial-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2248/jvns/git-tutorial-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2248
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/2] doc: remove gittutorial
  2026-10-06 19:37 [PATCH 0/2] WIP: doc: add new git tutorial Julia Evans via GitGitGadget
@ 2026-10-06 19:37 ` Julia Evans via GitGitGadget
  2026-10-06 19:37 ` [PATCH 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Julia Evans via GitGitGadget @ 2026-10-06 19:37 UTC (permalink / raw)
  To: git; +Cc: Julia Evans, Julia Evans

From: Julia Evans <julia@jvns.ca>

The next commit replaces it with a new tutorial.

Do this as a remove/add instead of just replacing the file in a single
commit to make the patches easier to read on the mailing list, since the
existing content isn't being reused.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/gittutorial.adoc | 676 ---------------------------------
 1 file changed, 676 deletions(-)
 delete mode 100644 Documentation/gittutorial.adoc

diff --git a/Documentation/gittutorial.adoc b/Documentation/gittutorial.adoc
deleted file mode 100644
index 519b8d8be2..0000000000
--- a/Documentation/gittutorial.adoc
+++ /dev/null
@@ -1,676 +0,0 @@
-gittutorial(7)
-==============
-
-NAME
-----
-gittutorial - A tutorial introduction to Git
-
-SYNOPSIS
---------
-[verse]
-git *
-
-DESCRIPTION
------------
-
-This tutorial explains how to import a new project into Git, make
-changes to it, and share changes with other developers.
-
-If you are instead primarily interested in using Git to fetch a project,
-for example, to test the latest version, you may prefer to start with
-the first two chapters of link:user-manual.html[The Git User's Manual].
-
-First, note that you can get documentation for a command such as
-`git log --graph` with:
-
-------------------------------------------------
-$ man git-log
-------------------------------------------------
-
-or:
-
-------------------------------------------------
-$ git help log
-------------------------------------------------
-
-With the latter, you can use the manual viewer of your choice; see
-linkgit:git-help[1] for more information.
-
-It is a good idea to introduce yourself to Git with your name and
-public email address before doing any operation.  The easiest
-way to do so is:
-
-------------------------------------------------
-$ git config --global user.name "Your Name Comes Here"
-$ git config --global user.email you@yourdomain.example.com
-------------------------------------------------
-
-
-Importing a new project
------------------------
-
-Assume you have a tarball `project.tar.gz` with your initial work.  You
-can place it under Git revision control as follows.
-
-------------------------------------------------
-$ tar xzf project.tar.gz
-$ cd project
-$ git init
-------------------------------------------------
-
-Git will reply
-
-------------------------------------------------
-Initialized empty Git repository in .git/
-------------------------------------------------
-
-You've now initialized the working directory--you may notice a new
-directory created, named `.git`.
-
-Next, tell Git to take a snapshot of the contents of all files under the
-current directory (note the `.`), with `git add`:
-
-------------------------------------------------
-$ git add .
-------------------------------------------------
-
-This snapshot is now stored in a temporary staging area which Git calls
-the "index".  You can permanently store the contents of the index in the
-repository with `git commit`:
-
-------------------------------------------------
-$ git commit
-------------------------------------------------
-
-This will prompt you for a commit message.  You've now stored the first
-version of your project in Git.
-
-Making changes
---------------
-
-Modify some files, then add their updated contents to the index:
-
-------------------------------------------------
-$ git add file1 file2 file3
-------------------------------------------------
-
-You are now ready to commit.  You can see what is about to be committed
-using `git diff` with the `--cached` option:
-
-------------------------------------------------
-$ git diff --cached
-------------------------------------------------
-
-(Without `--cached`, `git diff` will show you any changes that
-you've made but not yet added to the index.)  You can also get a brief
-summary of the situation with `git status`:
-
-------------------------------------------------
-$ git status
-On branch master
-Changes to be committed:
-  (use "git restore --staged <file>..." to unstage)
-
-	modified:   file1
-	modified:   file2
-	modified:   file3
-
-------------------------------------------------
-
-If you need to make any further adjustments, do so now, and then add any
-newly modified content to the index.  Finally, commit your changes with:
-
-------------------------------------------------
-$ git commit
-------------------------------------------------
-
-This will again prompt you for a message describing the change, and then
-record a new version of the project.
-
-Alternatively, instead of running `git add` beforehand, you can use
-
-------------------------------------------------
-$ git commit -a
-------------------------------------------------
-
-which will automatically notice any modified (but not new) files, add
-them to the index, and commit, all in one step.
-
-A note on commit messages: Though not required, it's a good idea to
-begin the commit message with a single short (no more than 50
-characters) line summarizing the change, followed by a blank line and
-then a more thorough description. The text up to the first blank line in
-a commit message is treated as the commit title, and that title is used
-throughout Git.  For example, linkgit:git-format-patch[1] turns a
-commit into email, and it uses the title on the Subject line and the
-rest of the commit in the body.
-
-Git tracks content not files
-----------------------------
-
-Many revision control systems provide an `add` command that tells the
-system to start tracking changes to a new file.  Git's `add` command
-does something simpler and more powerful: `git add` is used both for new
-and newly modified files, and in both cases it takes a snapshot of the
-given files and stages that content in the index, ready for inclusion in
-the next commit.
-
-Viewing project history
------------------------
-
-At any point you can view the history of your changes using
-
-------------------------------------------------
-$ git log
-------------------------------------------------
-
-If you also want to see complete diffs at each step, use
-
-------------------------------------------------
-$ git log -p
-------------------------------------------------
-
-Often the overview of the change is useful to get a feel of
-each step
-
-------------------------------------------------
-$ git log --stat --summary
-------------------------------------------------
-
-Managing branches
------------------
-
-A single Git repository can maintain multiple branches of
-development.  To create a new branch named `experimental`, use
-
-------------------------------------------------
-$ git branch experimental
-------------------------------------------------
-
-If you now run
-
-------------------------------------------------
-$ git branch
-------------------------------------------------
-
-you'll get a list of all existing branches:
-
-------------------------------------------------
-  experimental
-* master
-------------------------------------------------
-
-The `experimental` branch is the one you just created, and the
-`master` branch is a default branch that was created for you
-automatically.  The asterisk marks the branch you are currently on;
-type
-
-------------------------------------------------
-$ git switch experimental
-------------------------------------------------
-
-to switch to the `experimental` branch.  Now edit a file, commit the
-change, and switch back to the `master` branch:
-
-------------------------------------------------
-(edit file)
-$ git commit -a
-$ git switch master
-------------------------------------------------
-
-Check that the change you made is no longer visible, since it was
-made on the `experimental` branch and you're back on the `master` branch.
-
-You can make a different change on the `master` branch:
-
-------------------------------------------------
-(edit file)
-$ git commit -a
-------------------------------------------------
-
-at this point the two branches have diverged, with different changes
-made in each.  To merge the changes made in `experimental` into `master`, run
-
-------------------------------------------------
-$ git merge experimental
-------------------------------------------------
-
-If the changes don't conflict, you're done.  If there are conflicts,
-markers will be left in the problematic files showing the conflict;
-
-------------------------------------------------
-$ git diff
-------------------------------------------------
-
-will show this.  Once you've edited the files to resolve the
-conflicts,
-
-------------------------------------------------
-$ git commit -a
-------------------------------------------------
-
-will commit the result of the merge. Finally,
-
-------------------------------------------------
-$ gitk
-------------------------------------------------
-
-will show a nice graphical representation of the resulting history.
-
-At this point you could delete the `experimental` branch with
-
-------------------------------------------------
-$ git branch -d experimental
-------------------------------------------------
-
-This command ensures that the changes in the `experimental` branch are
-already in the current branch.
-
-If you develop on a branch `crazy-idea`, then regret it, you can always
-delete the branch with
-
--------------------------------------
-$ git branch -D crazy-idea
--------------------------------------
-
-Branches are cheap and easy, so this is a good way to try something
-out.
-
-Using Git for collaboration
----------------------------
-
-Suppose that Alice has started a new project with a Git repository in
-`/home/alice/project`, and that Bob, who has a home directory on the
-same machine, wants to contribute.
-
-Bob begins with:
-
-------------------------------------------------
-bob$ git clone /home/alice/project myrepo
-------------------------------------------------
-
-This creates a new directory `myrepo` containing a clone of Alice's
-repository.  The clone is on an equal footing with the original
-project, possessing its own copy of the original project's history.
-
-Bob then makes some changes and commits them:
-
-------------------------------------------------
-(edit files)
-bob$ git commit -a
-(repeat as necessary)
-------------------------------------------------
-
-When he's ready, he tells Alice to pull changes from the repository
-at `/home/bob/myrepo`.  She does this with:
-
-------------------------------------------------
-alice$ cd /home/alice/project
-alice$ git pull /home/bob/myrepo master
-------------------------------------------------
-
-This merges the changes from Bob's `master` branch into Alice's
-current branch.  If Alice has made her own changes in the meantime,
-then she may need to manually fix any conflicts.
-
-The `pull` command thus performs two operations: it fetches changes
-from a remote branch, then merges them into the current branch.
-
-Note that in general, Alice would want her local changes committed before
-initiating this `pull`.  If Bob's work conflicts with what Alice did since
-their histories forked, Alice will use her working tree and the index to
-resolve conflicts, and existing local changes will interfere with the
-conflict resolution process (Git will still perform the fetch but will
-refuse to merge -- Alice will have to get rid of her local changes in
-some way and pull again when this happens).
-
-Alice can peek at what Bob did without merging first, using the `fetch`
-command; this allows Alice to inspect what Bob did, using a special
-symbol `FETCH_HEAD`, in order to determine if he has anything worth
-pulling, like this:
-
-------------------------------------------------
-alice$ git fetch /home/bob/myrepo master
-alice$ git log -p HEAD..FETCH_HEAD
-------------------------------------------------
-
-This operation is safe even if Alice has uncommitted local changes.
-The range notation `HEAD..FETCH_HEAD` means "show everything that is reachable
-from the `FETCH_HEAD` but exclude anything that is reachable from `HEAD`".
-Alice already knows everything that leads to her current state (`HEAD`),
-and reviews what Bob has in his state (`FETCH_HEAD`) that she has not
-seen with this command.
-
-If Alice wants to visualize what Bob did since their histories forked
-she can issue the following command:
-
-------------------------------------------------
-$ gitk HEAD..FETCH_HEAD
-------------------------------------------------
-
-This uses the same two-dot range notation we saw earlier with `git log`.
-
-Alice may want to view what both of them did since they forked.
-She can use three-dot form instead of the two-dot form:
-
-------------------------------------------------
-$ gitk HEAD...FETCH_HEAD
-------------------------------------------------
-
-This means "show everything that is reachable from either one, but
-exclude anything that is reachable from both of them".
-
-Please note that these range notations can be used with both `gitk`
-and `git log`.
-
-After inspecting what Bob did, if there is nothing urgent, Alice may
-decide to continue working without pulling from Bob.  If Bob's history
-does have something Alice would immediately need, Alice may choose to
-stash her work-in-progress first, do a `pull`, and then finally unstash
-her work-in-progress on top of the resulting history.
-
-When you are working in a small closely knit group, it is not
-unusual to interact with the same repository over and over
-again.  By defining 'remote' repository shorthand, you can make
-it easier:
-
-------------------------------------------------
-alice$ git remote add bob /home/bob/myrepo
-------------------------------------------------
-
-With this, Alice can perform the first part of the `pull` operation
-alone using the `git fetch` command without merging them with her own
-branch, using:
-
--------------------------------------
-alice$ git fetch bob
--------------------------------------
-
-Unlike the longhand form, when Alice fetches from Bob using a
-remote repository shorthand set up with `git remote`, what was
-fetched is stored in a remote-tracking branch, in this case
-`bob/master`.  So after this:
-
--------------------------------------
-alice$ git log -p master..bob/master
--------------------------------------
-
-shows a list of all the changes that Bob made since he branched from
-Alice's `master` branch.
-
-After examining those changes, Alice
-could merge the changes into her `master` branch:
-
--------------------------------------
-alice$ git merge bob/master
--------------------------------------
-
-This `merge` can also be done by 'pulling from her own remote-tracking
-branch', like this:
-
--------------------------------------
-alice$ git pull . remotes/bob/master
--------------------------------------
-
-Note that git pull always merges into the current branch,
-regardless of what else is given on the command line.
-
-Later, Bob can update his repo with Alice's latest changes using
-
--------------------------------------
-bob$ git pull
--------------------------------------
-
-Note that he doesn't need to give the path to Alice's repository;
-when Bob cloned Alice's repository, Git stored the location of her
-repository in the repository configuration, and that location is
-used for pulls:
-
--------------------------------------
-bob$ git config --get remote.origin.url
-/home/alice/project
--------------------------------------
-
-(The complete configuration created by `git clone` is visible using
-`git config list`, and the linkgit:git-config[1] man page
-explains the meaning of each option.)
-
-Git also keeps a pristine copy of Alice's `master` branch under the
-name `origin/master`:
-
--------------------------------------
-bob$ git branch -r
-  origin/master
--------------------------------------
-
-If Bob later decides to work from a different host, he can still
-perform clones and pulls using the ssh protocol:
-
--------------------------------------
-bob$ git clone alice.org:/home/alice/project myrepo
--------------------------------------
-
-Alternatively, Git has a native protocol, or can use http;
-see linkgit:git-pull[1] for details.
-
-Git can also be used in a CVS-like mode, with a central repository
-that various users push changes to; see linkgit:git-push[1] and
-linkgit:gitcvs-migration[7].
-
-Exploring history
------------------
-
-Git history is represented as a series of interrelated commits.  We
-have already seen that the `git log` command can list those commits.
-Note that first line of each `git log` entry also gives a name for the
-commit:
-
--------------------------------------
-$ git log
-commit c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
-Author: Junio C Hamano <junkio@cox.net>
-Date:   Tue May 16 17:18:22 2006 -0700
-
-    merge-base: Clarify the comments on post processing.
--------------------------------------
-
-We can give this name to `git show` to see the details about this
-commit.
-
--------------------------------------
-$ git show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
--------------------------------------
-
-But there are other ways to refer to commits.  You can use any initial
-part of the name that is long enough to uniquely identify the commit:
-
--------------------------------------
-$ git show c82a22c39c	# the first few characters of the name are
-			# usually enough
-$ git show HEAD		# the tip of the current branch
-$ git show experimental	# the tip of the "experimental" branch
--------------------------------------
-
-Every commit usually has one "parent" commit
-which points to the previous state of the project:
-
--------------------------------------
-$ git show HEAD^  # to see the parent of HEAD
-$ git show HEAD^^ # to see the grandparent of HEAD
-$ git show HEAD~4 # to see the great-great grandparent of HEAD
--------------------------------------
-
-Note that merge commits may have more than one parent:
-
--------------------------------------
-$ git show HEAD^1 # show the first parent of HEAD (same as HEAD^)
-$ git show HEAD^2 # show the second parent of HEAD
--------------------------------------
-
-You can also give commits names of your own; after running
-
--------------------------------------
-$ git tag v2.5 1b2e1d63ff
--------------------------------------
-
-you can refer to `1b2e1d63ff` by the name `v2.5`.  If you intend to
-share this name with other people (for example, to identify a release
-version), you should create a "tag" object, and perhaps sign it; see
-linkgit:git-tag[1] for details.
-
-Any Git command that needs to know a commit can take any of these
-names.  For example:
-
--------------------------------------
-$ git diff v2.5 HEAD	 # compare the current HEAD to v2.5
-$ git branch stable v2.5 # start a new branch named "stable" based
-			 # at v2.5
-$ git reset --hard HEAD^ # reset your current branch and working
-			 # directory to its state at HEAD^
--------------------------------------
-
-Be careful with that last command: in addition to losing any changes
-in the working directory, it will also remove all later commits from
-this branch.  If this branch is the only branch containing those
-commits, they will be lost.  Also, don't use `git reset` on a
-publicly-visible branch that other developers pull from, as it will
-force needless merges on other developers to clean up the history.
-If you need to undo changes that you have pushed, use `git revert`
-instead.
-
-The `git grep` command can search for strings in any version of your
-project, so
-
--------------------------------------
-$ git grep "hello" v2.5
--------------------------------------
-
-searches for all occurrences of "hello" in `v2.5`.
-
-If you leave out the commit name, `git grep` will search any of the
-files it manages in your current directory.  So
-
--------------------------------------
-$ git grep "hello"
--------------------------------------
-
-is a quick way to search just the files that are tracked by Git.
-
-Many Git commands also take sets of commits, which can be specified
-in a number of ways.  Here are some examples with `git log`:
-
--------------------------------------
-$ git log v2.5..v2.6            # commits between v2.5 and v2.6
-$ git log v2.5..                # commits since v2.5
-$ git log --since="2 weeks ago" # commits from the last 2 weeks
-$ git log v2.5.. Makefile       # commits since v2.5 which modify
-				# Makefile
--------------------------------------
-
-You can also give `git log` a "range" of commits where the first is not
-necessarily an ancestor of the second; for example, if the tips of
-the branches `stable` and `master` diverged from a common
-commit some time ago, then
-
--------------------------------------
-$ git log stable..master
--------------------------------------
-
-will list commits made in the `master` branch but not in the
-stable branch, while
-
--------------------------------------
-$ git log master..stable
--------------------------------------
-
-will show the list of commits made on the stable branch but not
-the `master` branch.
-
-The `git log` command has a weakness: it must present commits in a
-list.  When the history has lines of development that diverged and
-then merged back together, the order in which `git log` presents
-those commits is meaningless.
-
-Most projects with multiple contributors (such as the Linux kernel,
-or Git itself) have frequent merges, and `gitk` does a better job of
-visualizing their history.  For example,
-
--------------------------------------
-$ gitk --since="2 weeks ago" drivers/
--------------------------------------
-
-allows you to browse any commits from the last 2 weeks of commits
-that modified files under the `drivers` directory.  (Note: you can
-adjust gitk's fonts by holding down the control key while pressing
-"-" or "+".)
-
-Finally, most commands that take filenames will optionally allow you
-to precede any filename by a commit, to specify a particular version
-of the file:
-
--------------------------------------
-$ git diff v2.5:Makefile HEAD:Makefile.in
--------------------------------------
-
-You can also use `git show` to see any such file:
-
--------------------------------------
-$ git show v2.5:Makefile
--------------------------------------
-
-Next Steps
-----------
-
-This tutorial should be enough to perform basic distributed revision
-control for your projects.  However, to fully understand the depth
-and power of Git you need to understand two simple ideas on which it
-is based:
-
-  * The object database is the rather elegant system used to
-    store the history of your project--files, directories, and
-    commits.
-
-  * The index file is a cache of the state of a directory tree,
-    used to create commits, check out working directories, and
-    hold the various trees involved in a merge.
-
-Part two of this tutorial explains the object
-database, the index file, and a few other odds and ends that you'll
-need to make the most of Git. You can find it at linkgit:gittutorial-2[7].
-
-If you don't want to continue with that right away, a few other
-digressions that may be interesting at this point are:
-
-  * linkgit:git-format-patch[1], linkgit:git-am[1]: These convert
-    series of git commits into emailed patches, and vice versa,
-    useful for projects such as the Linux kernel which rely heavily
-    on emailed patches.
-
-  * linkgit:git-bisect[1]: When there is a regression in your
-    project, one way to track down the bug is by searching through
-    the history to find the exact commit that's to blame.  `git bisect`
-    can help you perform a binary search for that commit.  It is
-    smart enough to perform a close-to-optimal search even in the
-    case of complex non-linear history with lots of merged branches.
-
-  * linkgit:gitworkflows[7]: Gives an overview of recommended
-    workflows.
-
-  * linkgit:giteveryday[7]: Everyday Git with 20 Commands Or So.
-
-  * linkgit:gitcvs-migration[7]: Git for CVS users.
-
-SEE ALSO
---------
-linkgit:gittutorial-2[7],
-linkgit:gitcvs-migration[7],
-linkgit:gitcore-tutorial[7],
-linkgit:gitglossary[7],
-linkgit:git-help[1],
-linkgit:gitworkflows[7],
-linkgit:giteveryday[7],
-link:user-manual.html[The Git User's Manual]
-
-GIT
----
-Part of the linkgit:git[1] suite
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/2] doc: add new Git tutorial for beginners
  2026-10-06 19:37 [PATCH 0/2] WIP: doc: add new git tutorial Julia Evans via GitGitGadget
  2026-10-06 19:37 ` [PATCH 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
@ 2026-10-06 19:37 ` Julia Evans via GitGitGadget
  2026-10-07 19:48   ` D. Ben Knoble
  2026-10-07 19:26 ` [PATCH 0/2] WIP: doc: add new git tutorial D. Ben Knoble
  2026-10-19 14:55 ` [PATCH v2 0/2] " Julia Evans via GitGitGadget
  3 siblings, 1 reply; 15+ messages in thread
From: Julia Evans via GitGitGadget @ 2026-10-06 19:37 UTC (permalink / raw)
  To: git; +Cc: Julia Evans, Julia Evans

From: Julia Evans <julia@jvns.ca>

This tutorial covers:

1. Creating an empty repo with `git init`
2. Making commits with `git add`, `git commit`, `git diff`, and
   `git status`
3. Pushing to code to a Git host on the internet, including creating an
   SSH key

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/gittutorial.adoc | 616 +++++++++++++++++++++++++++++++++
 1 file changed, 616 insertions(+)
 create mode 100644 Documentation/gittutorial.adoc

diff --git a/Documentation/gittutorial.adoc b/Documentation/gittutorial.adoc
new file mode 100644
index 0000000000..617dbae096
--- /dev/null
+++ b/Documentation/gittutorial.adoc
@@ -0,0 +1,616 @@
+gittutorial(7)
+==============
+
+NAME
+----
+gittutorial - Introduction to Git for beginners
+
+DESCRIPTION
+-----------
+
+This tutorial explains how to import a project's code into Git, make
+changes to it, and upload the project to the Internet.
+
+We'll show you how to use the commands `git commit`, `git add`,
+`git diff`, `git status`, and `git push`.
+
+Command line vs GUI
+-------------------
+
+Git is a command line program, but there are many excellent GUIs for
+Git built by the community. For example, if you use an IDE to edit your
+code, it might already have a built-in Git integration that you can use.
+
+In this tutorial, we'll give instructions for the command line version
+of Git, but you can also follow along in a GUI. You can also do some
+tasks in a GUI and some tasks on the command line. It's up to you.
+
+What we'll be doing
+-------------------
+
+Git lets you take snapshots of your code, like a checkpoint in a video
+game. In this tutorial we're going to explain a very basic Git
+workflow, which is:
+
+1. Create an empty folder
+2. Start using Git to manage the code in that folder
+3. Create 2 files and tell Git to save a snapshot of them
+4. Make changes to one of the files
+5. Tell Git to take another snapshot
+6. Repeat steps 4-5 any time you want to update your code
+
+We'll also explain how to use Git to put your code on the Internet.
+
+Step 1: Make sure Git is installed
+----------------------------------
+
+To do this tutorial, you'll need:
+
+1. Git to be installed. You might already have it installed,
+   and if not there are directions at https://git-scm.com/install/
+2. A folder on your computer with code that you want to start managing
+   with Git.
+
+You can check if Git is installed by running this in your terminal:
+
+------------------------------------------------
+$ git --version
+------------------------------------------------
+
+[[step_2]]
+Step 2: Introduce yourself to Git
+---------------------------------
+
+The first time you use Git on a computer, it's a good idea to tell Git
+your name and public email address. If you don't, you'll get a lot of
+warnings from Git. To do this, run:
+
+------------------------------------------------
+$ git config --global user.name "Namey McName"
+$ git config --global user.email you@example.com
+------------------------------------------------
+
+The name and email is so that other people you're collaborating with can
+know who made the changes. You can set them to anything you want.
+
+To check if the name and email have been set, you can run these
+commands:
+
+------------------------------------------------
+$ git config user.name
+$ git config user.email
+------------------------------------------------
+
+Set your default branch name to `main`, by running this command.
+Git is going to change its default branch name to `main` soon, so this
+sets you up well for the future.
+
+------------------------------------------------
+$ git config --global init.defaultBranch main
+------------------------------------------------
+
+If there's no output, then it succeeded.
+
+Step 3: Create an empty folder and 2 files
+------------------------------------------
+
+In your terminal, create an empty folder and change directories into it.
+Later on you could follow the same steps in this tutorial to take an
+existing project and start managing it with Git, but we're going to use
+an empty project so that everyone following this tutorial has the exact
+same files.
+
+For example, run these commands to make a folder called `myproject`
+
+------------------------------------------------
+$ mkdir myproject
+$ cd myproject
+------------------------------------------------
+
+Create 2 files in this directory, so we have something to work with.
+
+Make a file called README.md, with these contents:
+
+------------------------------------------------
+We're doing a Git tutorial!
+We need 2 lines in this file so here's a second one
+------------------------------------------------
+
+And a file called `hello.py`, with these contents:
+
+------------------------------------------------
+print("hello world")
+------------------------------------------------
+
+Save the two files and keep them open in your text editor so you can
+easily edit them later. The exact contents aren't too important, but
+we'll use those contents in the example output later.
+
+You can check that the files are in the right place by running `ls`,
+like this:
+
+
+------------------------------------------------
+$ ls
+------------------------------------------------
+
+The output should be like this:
+
+------------------------------------------------
+hello.py
+README.md
+------------------------------------------------
+
+Step 4: Create a Git repository
+-------------------------------
+
+A Git repository is a folder which stores snapshots. It's usually a
+hidden folder called `.git`. Every time you take a snapshot, Git stores
+a copy of the contents of every file you're tracking.
+
+This might feel unbelievable, but Git uses compression so you can easily
+store tens of thousands of snapshots without using too much disk space.
+
+You can create a Git repository for any folder in your computer by
+running the command `git init`.
+
+Run `git init` in the folder you just created, like this:
+
+------------------------------------------------
+$ git init
+------------------------------------------------
+
+Git will reply:
+
+------------------------------------------------
+Initialized empty Git repository in .git/
+------------------------------------------------
+
+You might notice a new hidden folder was created, named `.git`.
+
+Step 5: Take your first snapshot
+--------------------------------
+
+Next, we're going to take a snapshot of all the files in the directory
+and tell Git to store them. Taking a snapshot in Git is a two step
+process: first you need to run `git add` and then `git commit`.
+
+The reason it's a two step process is that sometimes you might not
+actually want Git to store a snapshot of _all_ the files in a folder.
+For example, if you have a file full of private personal information
+called `personal.csv`, and a Python script called `process_data.py`, you
+might want Git to keep a snapshot of the Python script but not the
+private data.
+
+For now, we're going to store a snapshot of every file in your folder,
+as well as in every subfolder.
+
+The first step of creating a snapshot is to tell Git which files you
+want to include in the next snapshot using `git add`. To tell Git
+"include all files", run this command:
+
+------------------------------------------------
+$ git add .
+------------------------------------------------
+
+Next you can create the snapshot using the `git commit` command, like
+this. The `-m` flag stands for "message", and it lets you set a reminder
+for your future self of what you were doing. The message ("Initial
+commit" in this example) can say anything you want.
+
+------------------------------------------------
+$ git commit -m "Initial commit"
+------------------------------------------------
+
+You've now stored the first version of your project in Git! From now on
+we're going to use the word "commit" instead of "snapshot", since that's
+the term Git uses.
+
+Step 6: Make a change
+---------------------
+
+Now, let's learn how to make a change to a file and review the change you made.
+In this example, we'll update the file `README.md`, but you can edit a
+different file.
+
+First open `README.md` in your favourite text editor, make a tiny or
+silly change, and save it.
+
+Next, in the terminal, run the command `git status` to get a summary of
+what you changed since the last Git commit.
+
+------------------------------------------------
+$ git status
+------------------------------------------------
+
+The output will look something like this:
+
+------------------------------------------------
+On branch main
+
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git restore <file>..." to discard changes in working directory)
+        modified:   README.md
+------------------------------------------------
+
+This output says that we've changed `README.md` since the last time
+we committed.
+
+Next, if you want to see the details of how you've changed `README.md`,
+you can run `git diff`.
+
+------------------------------------------------
+$ git diff
+------------------------------------------------
+
+The output will look something like this:
+
+------------------------------------------------
+diff --git a/README.md b/README.md
+index 7ebaecb3..5a4ff712 100644
+--- a/README.md
++++ b/README.md
+@@ -1,2 +1,2 @@
+ Here are some Python scripts!
++I hope you like them.
+------------------------------------------------
+
+This output says that we added one line, saying "I hope you like them.".
+By default Git will show the lines you removed in red, and the lines you
+added in green.
+
+Step 7: Make another commit (easy way)
+--------------------------------------
+
+Now let's tell Git to save the new version of `README.md` by making
+another commit! To tell Git to snapshot all files that Git is tracking
+and commit them, run this command:
+
+------------------------------------------------
+$ git commit -am "Update README"
+------------------------------------------------
+
+This is similar to the two step process in Step 4 where we used `git
+add` and `git commit` to make a commit, but with a shortcut that lets
+you do both in just one command. The `-a` stands for "all".
+
+Step 7b: Make another commit (longer way)
+-----------------------------------------
+
+`git commit -am` is a fast way to snapshot all the files that Git is
+tracking. But if you want Git to ignore changes to certain files, you
+can instead do a 2-step process like in Step 4 where first you run `git
+add` for every file that's been changed and that you want to include in
+the next commit, like this:
+
+------------------------------------------------
+$ git add README.md
+------------------------------------------------
+
+and then run `git commit` (without the `-a`), like this:
+
+------------------------------------------------
+$ git commit -m "Update README"
+------------------------------------------------
+
+Step 8: Make a change and throw it away
+---------------------------------------
+
+One of the most useful things about Git is that it lets you safely
+experiment: you never need to be scared to change your code because you
+can always go back to the old version.
+
+Before starting to experiment, run `git status` to check the current
+state of your Git repository:
+
+------------------------------------------------
+$ git status
+On branch main
+
+nothing to commit, working tree clean
+------------------------------------------------
+
+This "working tree clean" message means that there haven't been any
+changes since your last commit.
+
+Now make a change to your code, and run `git status` again. Like last
+time, you should see a message like this:
+
+------------------------------------------------
+$ git status
+On branch main
+
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git restore <file>..." to discard changes in working directory)
+        modified:   README.md
+------------------------------------------------
+
+This tells us that `README.md` has been changed since the last commit.
+But we don't actually want this change, so let's undo it! We can restore
+`README.md` back to how it was at the most recent commit using the `git
+restore` command.
+
+**WARNING**: `git restore` can't be reversed! Any time you run it it's
+important to be absolutely sure that you're okay with throwing away your
+changes since the last commit.
+
+------------------------------------------------
+$ git restore README.md
+------------------------------------------------
+
+Now open `README.md` again. You should see that your changes have been undone.
+
+You can stop here!
+------------------
+
+The commands we've learned so far (`git init`, `git add`, `git commit`,
+`git diff`, `git status`, and `git restore`) are enough to get a lot out
+of Git on their own.
+
+With these commands, you can keep copies of past versions of your code
+on your computer and safely experiment with big changes to your code.
+
+When using Git this way, all of your code just lives on your computer.
+But if you want to put your code on the Internet so that other people
+can use it or back it up, then you'll need to learn about one more
+command: `git push`.
+
+The rest of this tutorial is about how to upload your code to a Git
+repository on the Internet. The high level process is:
+
+1. Create an account on the Git host
+2. Configure Git so that it can login to the Git host to make changes
+3. Run `git push origin main` to upload your code
+
+Navigating the Git host's UI can be tricky, and it's hard for us to
+give you exact directions because the UIs change a lot.
+
+Step 9: Create an account on a Git host
+---------------------------------------
+
+To put your code on the Internet, you need it to be hosted somewhere.
+The easiest way to do this is to sign up with a Git host. There's a list
+of Git hosts (many of them offer free accounts) at
+https://git-scm.com/tools/hosting. GitHub and GitLab are two popular hosts.
+
+If you're comfortable running a server, there are other ways to host
+a Git repository on the internet, like connecting through SSH or open
+source Git forge software to your server.
+
+Step 10: Create an SSH key (if needed)
+-------------------------------------
+
+For Git to upload changes to another Git repository, it needs a way to
+login to that repository. One of the most popular ways to do this is
+with an SSH key.
+
+If you don't already have an SSH key, you'll need to create one. On Mac
+or Linux, you can check if you already have an SSH key by running:
+
+-------------------------------------------
+$ ls ~/.ssh/*.pub
+-------------------------------------------
+
+If you don't already have an SSH key, run:
+
+-------------------------------------------
+$ ssh-keygen
+-------------------------------------------
+
+`ssh-keygen` will ask you for some details.
+The easiest way to do this is to just press Enter at every prompt until
+it's done.
+
+NOTE: All of the advice about how to use SSH in this tutorial is aimed
+at getting it to work as quickly as possible. Setting up SSH in a secure
+way is very far outside the scope of this tutorial. If you have a
+security team in your organization, they might have very different
+opinions about the appropriate way to configure authentication with Git.
+
+Step 11: Tell the Git host your SSH public key
+----------------------------------------------
+
+First, find your SSH key like this (on Mac or Linux):
+
+-------------------------------------------
+$ ls ~/.ssh/*.pub
+-------------------------------------------
+
+That will output something like
+
+-------------------------------------------
+/home/alice/.ssh/id_ed25519.pub
+-------------------------------------------
+
+Copy the contents of that file to your clipboard. It's important that
+the filename ends in `.pub` ("pub" stands for "public").
+
+Then login to your account on the Git host you chose and paste the SSH
+key into the appropriate place. Depending on the Git host, it's likely
+under "SSH keys" in your settings. If it asks you what type of SSH key,
+look for something like "Authentication Key".
+
+Once you've done this, you're done! Git will automatically use your SSH
+key to try to connect.
+
+Step 12: Create an empty Git repository on the Git host
+-------------------------------------------------------
+
+Go to the Git host's website and create a new Git repository.
+
+**WARNING**: If you create a public repository and push your repository
+to it, then your name and email address, as well as the contents of
+any files you committed and every previous version of those files, will
+be on the public internet. Some Git hosts have the option to create
+a private repository instead, to keep your information private.
+
+Step 13: Find the address of the repository
+-------------------------------------------
+
+Now, find the address of the repository on your Git host. It should look
+something like this:
+
+-------------------------------------------
+git@git.example.com:username/repo.git
+-------------------------------------------
+
+(where `example.com`, `username` and `repo` will be replaced with the
+actual values).
+
+If you can only find an address starting with `https://`, then
+you can often translate it to the SSH format by replacing `https://`
+with `git@` and replacing the `/` after the domain name with an `:`.
+Here's how:
+
+-------------------------------------------
+https://git.example.com/username/repo
+^^^^^^^^               ^
+replace with "git@"    replace with ":"
+-------------------------------------------
+
+Step 14: push your changes
+--------------------------
+
+Finally, we're ready to send the information in your local Git repository
+to the one on the internet!
+
+First, tell Git about the other repository by running `git remote add`
+in your terminal
+(replace `git@example.com:username/repo.git` with the actual address):
+
+-------------------------------------------
+$ git remote add origin git@example.com:username/repo.git
+-------------------------------------------
+
+This tells Git to save the URL `git@example.com:username/repo.git` in
+your Git repository's configuration under the name `origin`, so that you
+can use it later. If you make a mistake while doing this, you can run
+`git remote remove origin` and try again.
+
+Then tell Git to send the information, with `git push`
+(if this doesn't work, read the "Troubleshooting `git push`" section for advice!):
+
+-------------------------------------------
+$ git push -u origin main
+-------------------------------------------
+
+`origin` refers to the URL we just added (`git@example.com:username/repo.git`),
+and `main` is the name of your current Git branch. You can use any name
+(not just `origin`), but using `origin` often makes things easier
+because it's the default for `git push` and `git pull`.
+We haven't covered branches yet, but `main` is the default branch name.
+
+Any time you want to set up a new repository, you can repeat steps
+11-13, with one exception: you only need to pass `-u` the first time
+you push. Afterwards you can just run the command:
+
+-------------------------------------------
+$ git push origin main
+-------------------------------------------
+
+It should output something like this:
+
+-------------------------------------------
+To example.com:example_username/example
+ * [new branch]        main -> main
+-------------------------------------------
+
+Troubleshooting `git push`
+--------------------------
+
+There are 3 main errors you might run into when running `git push origin main`.
+Getting errors when running `git push` is actually a big part of using
+Git, so congratulations! If you get to this part of the tutorial, you
+get a little bonus experience in debugging.
+
+Here's a guide to why they're happening and how to fix them.
+
+**Problem 1**: You pushed to `main`, but your branch actually isn't called `main`
+
+Here's the error:
+```
+$ git push origin main
+error: src refspec main does not match any
+```
+
+This might happen if you didn't set `init.defaultBranch` to `main` in
+<<step_2,Step 2>>.
+
+If you want to check the name of your current branch, you can run `git
+status`. For example, in this output, the current branch is "master".
+
+-------------------------------------------
+$ git status
+On branch master
+
+...
+-------------------------------------------
+
+To push your branch, you have a few options:
+
+* rename your branch to `main`, by running `git branch -m main`
+  and then run `git push origin main`
+* run `git push origin master`
+  (where `master` is the name of your actual current branch)
+
+**Problem 2: SSH error**
+
+Here's the error:
+
+-----
+$ git push origin main
+The authenticity of host 'github.com (140.82.116.3)' can't be established.
+ED25519 key fingerprint is: SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
+This key is not known by any other names.
+Are you sure you want to continue connecting (yes/no/[fingerprint])?
+-----
+
+Git uses SSH to connect during `git push`, and this message happens when
+SSH connects to a new site that you haven't connected to before.
+
+The easiest way to handle this is to type "yes" and press Enter.
+
+**Problem 3: the repository already exists**
+
+Here's the error:
+
+---------------------
+$ git push origin main
+! [rejected]        main -> main (fetch first)
+error: failed to push some refs to 'example.com:example/example.git'
+hint: Updates were rejected because the remote contains work that you do not
+hint: have locally.
+---------------------
+
+If you see an error like this, it means that when you created the
+repository on your Git host, it created a repository with a file in it
+to try to help you out. (that's the "work that you do not have locally"
+in the error message)
+
+You can fix this either by deleting the repository and recreating it, or
+by running:
+
+---------------------
+$ git push --force origin main
+---------------------
+
+**WARNING**: In general it's quite dangerous to use `--force` because
+it can erase work on the online repository in a way that's difficult to
+recover. But if you know for sure that you just created the repository 2
+minutes ago and there's nothing in it, then it's okay.
+
+MORE USEFUL GIT COMMANDS
+------------------------
+
+* To tell Git to "un-add" a file that you added by accident, run
+  `git rm --cached FILENAME`
+
+SEE ALSO
+--------
+linkgit:git-help[1],
+
+GIT
+---
+Part of the linkgit:git[1] suite
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/2] WIP: doc: add new git tutorial
  2026-10-06 19:37 [PATCH 0/2] WIP: doc: add new git tutorial Julia Evans via GitGitGadget
  2026-10-06 19:37 ` [PATCH 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
  2026-10-06 19:37 ` [PATCH 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
@ 2026-10-07 19:26 ` D. Ben Knoble
  2026-10-19 14:55 ` [PATCH v2 0/2] " Julia Evans via GitGitGadget
  3 siblings, 0 replies; 15+ messages in thread
From: D. Ben Knoble @ 2026-10-07 19:26 UTC (permalink / raw)
  To: Julia Evans via GitGitGadget; +Cc: git, Julia Evans

On Tue, Oct 6, 2026 at 3:40 PM Julia Evans via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> This is the first draft of a tutorial which introduces Git in two parts:
>
> Part 1: Create an empty repo & make 2 commits (git init, git add, git
> commit, git status, git diff) Part 2: Push the repo to a remote host like
> GitHub or GitLab (git remote add, git push)
>
> So far we've gotten 112 comments from 22 beta testers who have tried to
> learn Git for the first using this tutorial. Most of them were able to
> finish it successfully. I'd like to avoid getting into the details of every
> single thing in the tutorial at this stage (we're still planning to do a
> second round of feedback with the beta testers, and the beginning especially
> will likely change)
>
> There are 2 questions I'd like feedback on since they both could affect the
> structure of the tutorial. I don't think either of these is a dealbreaker,
> since folks generally were able to finish the tutorial despite all these
> issues and said that they enjoyed it and learned a lot. But it would be
> great if there were an easy way to make the process less messy.
>
>
> question 1: create the repo on the command line, or in the forge?
> =================================================================

> c. Just try to get users to try to figure the right way in the
> GitLab/GitHub/etc UI to actually create an empty repository that it's
> possible to just push to. This is really hard because the UIs constantly
> change.
>
>
> current solution 1
> ==================
>
> Right now we're working on Option C since it seems least bad
>
>
> question 2: How to handle authentication
> ========================================

> current solution 2
> ==================
>
> Right now we're solving these by:
>
>  1. Using SSH
>  2. Explaining how to set up SSH in the easiest way possible (with
>     disclaimers to check your security team's policy if applicable since the
>     "easiest way" may not be the best)
>  3. Giving some instructions for how to translate an HTTPS URL to an SSH URL

Disclaimer, I haven't read the patches yet.

Both of these approaches sound like the right one to me. Assuming
we're suggesting up-to-date key algorithms for SSH, I think that
should be fine. (Memory says ECDSA and ED22519, I think? I'm not sure
about the differences, but my regularly-used keys are the latter and
my newest is the former.)

I happen to use a somewhat convoluted "new key for each host" policy
for myself, which ends up with lots of "Host <host> IdentifyFile
<key>" in ~/.ssh/config and "Include"d files. I think separate keys
per host is a good idea, but I certainly wouldn't want to foist that
mess on new users. OTOH, even leaving an admonition "you probably want
to set up one key per host later, so consider this just a starting
point" is how such starting points become prolific use practice ;)

So, idk on that front. Probably it's over-complicated to do that here,
and point to better guides (or worry about making one externally if
none exist), leaving the admonition in.

Thanks for letting me think aloud,
Ben

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] doc: add new Git tutorial for beginners
  2026-10-06 19:37 ` [PATCH 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
@ 2026-10-07 19:48   ` D. Ben Knoble
  2026-10-19 14:24     ` Julia Evans
  0 siblings, 1 reply; 15+ messages in thread
From: D. Ben Knoble @ 2026-10-07 19:48 UTC (permalink / raw)
  To: Julia Evans via GitGitGadget; +Cc: git, Julia Evans

On Tue, Oct 6, 2026 at 3:37 PM Julia Evans via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Julia Evans <julia@jvns.ca>
>
> This tutorial covers:
>
> 1. Creating an empty repo with `git init`
> 2. Making commits with `git add`, `git commit`, `git diff`, and
>    `git status`
> 3. Pushing to code to a Git host on the internet, including creating an
>    SSH key
>
> Signed-off-by: Julia Evans <julia@jvns.ca>
> ---
>  Documentation/gittutorial.adoc | 616 +++++++++++++++++++++++++++++++++
>  1 file changed, 616 insertions(+)
>  create mode 100644 Documentation/gittutorial.adoc
>
> diff --git a/Documentation/gittutorial.adoc b/Documentation/gittutorial.adoc
> new file mode 100644
> index 0000000000..617dbae096
> --- /dev/null
> +++ b/Documentation/gittutorial.adoc
> @@ -0,0 +1,616 @@
> +gittutorial(7)
> +==============
> +
> +NAME
> +----
> +gittutorial - Introduction to Git for beginners
> +
> +DESCRIPTION
> +-----------
> +
> +This tutorial explains how to import a project's code into Git, make
> +changes to it, and upload the project to the Internet.
> +
> +We'll show you how to use the commands `git commit`, `git add`,
> +`git diff`, `git status`, and `git push`.
> +
> +Command line vs GUI
> +-------------------
> +
> +Git is a command line program, but there are many excellent GUIs for
> +Git built by the community. For example, if you use an IDE to edit your
> +code, it might already have a built-in Git integration that you can use.
> +
> +In this tutorial, we'll give instructions for the command line version
> +of Git, but you can also follow along in a GUI. You can also do some
> +tasks in a GUI and some tasks on the command line. It's up to you.

Since we assume a *nix-ish environment, should we mention that this
tutorial works best on UNIX-like OSs, or in a Git-for-Windows Bash
environment, and may need adapting for folks using PowerShell, CMD, or
some other userspace (not a piece of jargon I would use here,
probably)? Or does that get covered incidentally by the installation
instructions?

I'm especially thinking of not confusing a user who sees something
different or doesn't have an "ls", "cd", etc. (Maybe my Windows
command line knowledge is shoddy, though, and those parts just kind of
work close enough for our purposes?)

> +
> +What we'll be doing
> +-------------------
> +
> +Git lets you take snapshots of your code, like a checkpoint in a video
> +game. In this tutorial we're going to explain a very basic Git
> +workflow, which is:
> +
> +1. Create an empty folder
> +2. Start using Git to manage the code in that folder
> +3. Create 2 files and tell Git to save a snapshot of them
> +4. Make changes to one of the files
> +5. Tell Git to take another snapshot
> +6. Repeat steps 4-5 any time you want to update your code

I'm very tempted to nitpick "folder" vs "directory," but I'm not sure
it's worth our time or that of the target audience :) Just note that,
while "git grep folder" finds way more hits than I was expecting, it
seems the primary use in our documentation is in reference to IMAP.

> +We'll also explain how to use Git to put your code on the Internet.
> +
> +Step 1: Make sure Git is installed
> +----------------------------------
> +
> +To do this tutorial, you'll need:
> +
> +1. Git to be installed. You might already have it installed,
> +   and if not there are directions at https://git-scm.com/install/
> +2. A folder on your computer with code that you want to start managing
> +   with Git.
> +
> +You can check if Git is installed by running this in your terminal:
> +
> +------------------------------------------------
> +$ git --version
> +------------------------------------------------
> +
> +[[step_2]]
> +Step 2: Introduce yourself to Git
> +---------------------------------
> +
> +The first time you use Git on a computer, it's a good idea to tell Git
> +your name and public email address. If you don't, you'll get a lot of
> +warnings from Git. To do this, run:
> +
> +------------------------------------------------
> +$ git config --global user.name "Namey McName"
> +$ git config --global user.email you@example.com
> +------------------------------------------------
> +
> +The name and email is so that other people you're collaborating with can
> +know who made the changes. You can set them to anything you want.
> +
> +To check if the name and email have been set, you can run these
> +commands:
> +
> +------------------------------------------------
> +$ git config user.name
> +$ git config user.email
> +------------------------------------------------

Ought we recommend the newer forms (git config set, git config get)?
Or is the idea to remain compatible with older versions, such as the
2.32 I happen to have in /usr/bin on unsupported macOS 12.7.6 from
very old (?) XCode?

> +
> +Set your default branch name to `main`, by running this command.
> +Git is going to change its default branch name to `main` soon, so this
> +sets you up well for the future.
> +
> +------------------------------------------------
> +$ git config --global init.defaultBranch main
> +------------------------------------------------
> +
> +If there's no output, then it succeeded.
> +
> +Step 3: Create an empty folder and 2 files
> +------------------------------------------
> +
> +In your terminal, create an empty folder and change directories into it.
> +Later on you could follow the same steps in this tutorial to take an
> +existing project and start managing it with Git, but we're going to use
> +an empty project so that everyone following this tutorial has the exact
> +same files.
> +
> +For example, run these commands to make a folder called `myproject`
> +
> +------------------------------------------------
> +$ mkdir myproject
> +$ cd myproject
> +------------------------------------------------

I don't know, and I'll probably bias towards what you've already
written over asking for changes, but: does it make things any easier
to read and follow along with if we "git init myproject" instead?
Perhaps this version plants the seed that it's not too late to start
tracking any existing project, though, which is valuable :)

I wonder if you had some rationale for choosing this particular
sequence? Just curious, now.

> +Create 2 files in this directory, so we have something to work with.
> +
> +Make a file called README.md, with these contents:
> +
> +------------------------------------------------
> +We're doing a Git tutorial!
> +We need 2 lines in this file so here's a second one
> +------------------------------------------------
> +
> +And a file called `hello.py`, with these contents:
> +
> +------------------------------------------------
> +print("hello world")
> +------------------------------------------------
> +
> +Save the two files and keep them open in your text editor so you can
> +easily edit them later. The exact contents aren't too important, but
> +we'll use those contents in the example output later.
> +
> +You can check that the files are in the right place by running `ls`,
> +like this:
> +
> +
> +------------------------------------------------
> +$ ls
> +------------------------------------------------
> +
> +The output should be like this:
> +
> +------------------------------------------------
> +hello.py
> +README.md
> +------------------------------------------------
> +
> +Step 4: Create a Git repository
> +-------------------------------
> +
> +A Git repository is a folder which stores snapshots. It's usually a
> +hidden folder called `.git`. Every time you take a snapshot, Git stores
> +a copy of the contents of every file you're tracking.
> +
> +This might feel unbelievable, but Git uses compression so you can easily
> +store tens of thousands of snapshots without using too much disk space.
> +
> +You can create a Git repository for any folder in your computer by
> +running the command `git init`.
> +
> +Run `git init` in the folder you just created, like this:
> +
> +------------------------------------------------
> +$ git init
> +------------------------------------------------
> +
> +Git will reply:
> +
> +------------------------------------------------
> +Initialized empty Git repository in .git/
> +------------------------------------------------
> +
> +You might notice a new hidden folder was created, named `.git`.
> +
> +Step 5: Take your first snapshot
> +--------------------------------
> +
> +Next, we're going to take a snapshot of all the files in the directory
> +and tell Git to store them. Taking a snapshot in Git is a two step
> +process: first you need to run `git add` and then `git commit`.
> +
> +The reason it's a two step process is that sometimes you might not
> +actually want Git to store a snapshot of _all_ the files in a folder.
> +For example, if you have a file full of private personal information
> +called `personal.csv`, and a Python script called `process_data.py`, you
> +might want Git to keep a snapshot of the Python script but not the
> +private data.
> +
> +For now, we're going to store a snapshot of every file in your folder,
> +as well as in every subfolder.
> +
> +The first step of creating a snapshot is to tell Git which files you
> +want to include in the next snapshot using `git add`. To tell Git
> +"include all files", run this command:
> +
> +------------------------------------------------
> +$ git add .
> +------------------------------------------------
> +
> +Next you can create the snapshot using the `git commit` command, like
> +this. The `-m` flag stands for "message", and it lets you set a reminder
> +for your future self of what you were doing. The message ("Initial
> +commit" in this example) can say anything you want.
> +
> +------------------------------------------------
> +$ git commit -m "Initial commit"
> +------------------------------------------------
> +
> +You've now stored the first version of your project in Git! From now on
> +we're going to use the word "commit" instead of "snapshot", since that's
> +the term Git uses.

I know we want to limit scope… but I would love to not accidentally
encourage more use of "-m" for short (often useless?) messages.
Unfortunately, that drags in the can of worms that is editor
configuration. At least we can maybe point to
https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup#_editor
and https://git-scm.com/book/en/v2/Appendix-C:-Git-Commands-Setup-and-Config#ch_core_editor
? idk.

> +
> +Step 6: Make a change
> +---------------------
> +
> +Now, let's learn how to make a change to a file and review the change you made.
> +In this example, we'll update the file `README.md`, but you can edit a
> +different file.
> +
> +First open `README.md` in your favourite text editor, make a tiny or
> +silly change, and save it.
> +
> +Next, in the terminal, run the command `git status` to get a summary of
> +what you changed since the last Git commit.
> +
> +------------------------------------------------
> +$ git status
> +------------------------------------------------
> +
> +The output will look something like this:
> +
> +------------------------------------------------
> +On branch main
> +
> +Changes not staged for commit:
> +  (use "git add <file>..." to update what will be committed)
> +  (use "git restore <file>..." to discard changes in working directory)
> +        modified:   README.md
> +------------------------------------------------
> +
> +This output says that we've changed `README.md` since the last time
> +we committed.
> +
> +Next, if you want to see the details of how you've changed `README.md`,
> +you can run `git diff`.
> +
> +------------------------------------------------
> +$ git diff
> +------------------------------------------------
> +
> +The output will look something like this:
> +
> +------------------------------------------------
> +diff --git a/README.md b/README.md
> +index 7ebaecb3..5a4ff712 100644
> +--- a/README.md
> ++++ b/README.md
> +@@ -1,2 +1,2 @@
> + Here are some Python scripts!
> ++I hope you like them.
> +------------------------------------------------
> +
> +This output says that we added one line, saying "I hope you like them.".
> +By default Git will show the lines you removed in red, and the lines you
> +added in green.

I would perhaps prefer to focus on the leading sigils (-, +) than the
color, if only because colorblindness can lead to all sorts of
situations with different color setups in the terminal's palette or
even (probably not our target audience) Git configuration. We could
probably mention that Git shows added and removed lines in *different*
colors without being too concerned with which colors those are? (That
avoids having to twist our words like "your terminal palette's green
and red" or w/e.)

> +
> +Step 7: Make another commit (easy way)
> +--------------------------------------
> +
> +Now let's tell Git to save the new version of `README.md` by making
> +another commit! To tell Git to snapshot all files that Git is tracking
> +and commit them, run this command:
> +
> +------------------------------------------------
> +$ git commit -am "Update README"
> +------------------------------------------------
> +
> +This is similar to the two step process in Step 4 where we used `git
> +add` and `git commit` to make a commit, but with a shortcut that lets
> +you do both in just one command. The `-a` stands for "all".
> +
> +Step 7b: Make another commit (longer way)
> +-----------------------------------------
> +
> +`git commit -am` is a fast way to snapshot all the files that Git is
> +tracking. But if you want Git to ignore changes to certain files, you
> +can instead do a 2-step process like in Step 4 where first you run `git
> +add` for every file that's been changed and that you want to include in
> +the next commit, like this:
> +
> +------------------------------------------------
> +$ git add README.md
> +------------------------------------------------
> +
> +and then run `git commit` (without the `-a`), like this:
> +
> +------------------------------------------------
> +$ git commit -m "Update README"
> +------------------------------------------------
> +
> +Step 8: Make a change and throw it away
> +---------------------------------------
> +
> +One of the most useful things about Git is that it lets you safely
> +experiment: you never need to be scared to change your code because you
> +can always go back to the old version.
> +
> +Before starting to experiment, run `git status` to check the current
> +state of your Git repository:
> +
> +------------------------------------------------
> +$ git status
> +On branch main
> +
> +nothing to commit, working tree clean
> +------------------------------------------------
> +
> +This "working tree clean" message means that there haven't been any
> +changes since your last commit.
> +
> +Now make a change to your code, and run `git status` again. Like last
> +time, you should see a message like this:
> +
> +------------------------------------------------
> +$ git status
> +On branch main
> +
> +Changes not staged for commit:
> +  (use "git add <file>..." to update what will be committed)
> +  (use "git restore <file>..." to discard changes in working directory)
> +        modified:   README.md
> +------------------------------------------------
> +
> +This tells us that `README.md` has been changed since the last commit.
> +But we don't actually want this change, so let's undo it! We can restore
> +`README.md` back to how it was at the most recent commit using the `git
> +restore` command.
> +
> +**WARNING**: `git restore` can't be reversed! Any time you run it it's
> +important to be absolutely sure that you're okay with throwing away your
> +changes since the last commit.
> +
> +------------------------------------------------
> +$ git restore README.md
> +------------------------------------------------
> +
> +Now open `README.md` again. You should see that your changes have been undone.
> +
> +You can stop here!
> +------------------
> +
> +The commands we've learned so far (`git init`, `git add`, `git commit`,
> +`git diff`, `git status`, and `git restore`) are enough to get a lot out
> +of Git on their own.
> +
> +With these commands, you can keep copies of past versions of your code
> +on your computer and safely experiment with big changes to your code.
> +
> +When using Git this way, all of your code just lives on your computer.
> +But if you want to put your code on the Internet so that other people
> +can use it or back it up, then you'll need to learn about one more
> +command: `git push`.
> +
> +The rest of this tutorial is about how to upload your code to a Git
> +repository on the Internet. The high level process is:
> +
> +1. Create an account on the Git host
> +2. Configure Git so that it can login to the Git host to make changes
> +3. Run `git push origin main` to upload your code
> +
> +Navigating the Git host's UI can be tricky, and it's hard for us to
> +give you exact directions because the UIs change a lot.
> +
> +Step 9: Create an account on a Git host
> +---------------------------------------
> +
> +To put your code on the Internet, you need it to be hosted somewhere.
> +The easiest way to do this is to sign up with a Git host. There's a list
> +of Git hosts (many of them offer free accounts) at
> +https://git-scm.com/tools/hosting. GitHub and GitLab are two popular hosts.
> +
> +If you're comfortable running a server, there are other ways to host
> +a Git repository on the internet, like connecting through SSH or open
> +source Git forge software to your server.
> +
> +Step 10: Create an SSH key (if needed)
> +-------------------------------------
> +
> +For Git to upload changes to another Git repository, it needs a way to
> +login to that repository. One of the most popular ways to do this is
> +with an SSH key.
> +
> +If you don't already have an SSH key, you'll need to create one. On Mac
> +or Linux, you can check if you already have an SSH key by running:
> +
> +-------------------------------------------
> +$ ls ~/.ssh/*.pub
> +-------------------------------------------
> +
> +If you don't already have an SSH key, run:
> +
> +-------------------------------------------
> +$ ssh-keygen
> +-------------------------------------------
> +
> +`ssh-keygen` will ask you for some details.
> +The easiest way to do this is to just press Enter at every prompt until
> +it's done.
> +
> +NOTE: All of the advice about how to use SSH in this tutorial is aimed
> +at getting it to work as quickly as possible. Setting up SSH in a secure
> +way is very far outside the scope of this tutorial. If you have a
> +security team in your organization, they might have very different
> +opinions about the appropriate way to configure authentication with Git.
> +
> +Step 11: Tell the Git host your SSH public key
> +----------------------------------------------
> +
> +First, find your SSH key like this (on Mac or Linux):
> +
> +-------------------------------------------
> +$ ls ~/.ssh/*.pub
> +-------------------------------------------
> +
> +That will output something like
> +
> +-------------------------------------------
> +/home/alice/.ssh/id_ed25519.pub
> +-------------------------------------------
> +
> +Copy the contents of that file to your clipboard. It's important that
> +the filename ends in `.pub` ("pub" stands for "public").
> +
> +Then login to your account on the Git host you chose and paste the SSH
> +key into the appropriate place. Depending on the Git host, it's likely
> +under "SSH keys" in your settings. If it asks you what type of SSH key,
> +look for something like "Authentication Key".
> +
> +Once you've done this, you're done! Git will automatically use your SSH
> +key to try to connect.
> +
> +Step 12: Create an empty Git repository on the Git host
> +-------------------------------------------------------
> +
> +Go to the Git host's website and create a new Git repository.
> +
> +**WARNING**: If you create a public repository and push your repository
> +to it, then your name and email address, as well as the contents of
> +any files you committed and every previous version of those files, will
> +be on the public internet. Some Git hosts have the option to create
> +a private repository instead, to keep your information private.
> +
> +Step 13: Find the address of the repository
> +-------------------------------------------
> +
> +Now, find the address of the repository on your Git host. It should look
> +something like this:
> +
> +-------------------------------------------
> +git@git.example.com:username/repo.git
> +-------------------------------------------
> +
> +(where `example.com`, `username` and `repo` will be replaced with the
> +actual values).
> +
> +If you can only find an address starting with `https://`, then
> +you can often translate it to the SSH format by replacing `https://`
> +with `git@` and replacing the `/` after the domain name with an `:`.
> +Here's how:
> +
> +-------------------------------------------
> +https://git.example.com/username/repo
> +^^^^^^^^               ^
> +replace with "git@"    replace with ":"
> +-------------------------------------------

This is, of course, forge- and remote- dependent :) but I think it's
*probably* ok for the tutorial.

When you mentioned HTTPS-to-SSH translation, I was thinking of the
config-based URL rewrite mechanism, aha! I definitely don't think we
should go there ;)

> +
> +Step 14: push your changes
> +--------------------------
> +
> +Finally, we're ready to send the information in your local Git repository
> +to the one on the internet!
> +
> +First, tell Git about the other repository by running `git remote add`
> +in your terminal
> +(replace `git@example.com:username/repo.git` with the actual address):
> +
> +-------------------------------------------
> +$ git remote add origin git@example.com:username/repo.git
> +-------------------------------------------
> +
> +This tells Git to save the URL `git@example.com:username/repo.git` in
> +your Git repository's configuration under the name `origin`, so that you
> +can use it later. If you make a mistake while doing this, you can run
> +`git remote remove origin` and try again.
> +
> +Then tell Git to send the information, with `git push`
> +(if this doesn't work, read the "Troubleshooting `git push`" section for advice!):
> +
> +-------------------------------------------
> +$ git push -u origin main
> +-------------------------------------------
> +
> +`origin` refers to the URL we just added (`git@example.com:username/repo.git`),
> +and `main` is the name of your current Git branch. You can use any name
> +(not just `origin`), but using `origin` often makes things easier
> +because it's the default for `git push` and `git pull`.
> +We haven't covered branches yet, but `main` is the default branch name.

I'm not sure if we should recommend "-u" without being able to explain
what it does, and… well… you and I have discussed how that's difficult
:)

Doesn't the tutorial's recipe of always using "git push origin main"
work just fine? And if we later introduce pull and other
branch-/remote-stuff that cares about upstreams, we can mention this
shorthand then?

> +
> +Any time you want to set up a new repository, you can repeat steps
> +11-13, with one exception: you only need to pass `-u` the first time
> +you push. Afterwards you can just run the command:
> +
> +-------------------------------------------
> +$ git push origin main
> +-------------------------------------------
> +
> +It should output something like this:
> +
> +-------------------------------------------
> +To example.com:example_username/example
> + * [new branch]        main -> main
> +-------------------------------------------
> +
> +Troubleshooting `git push`
> +--------------------------
> +
> +There are 3 main errors you might run into when running `git push origin main`.
> +Getting errors when running `git push` is actually a big part of using
> +Git, so congratulations! If you get to this part of the tutorial, you
> +get a little bonus experience in debugging.
> +
> +Here's a guide to why they're happening and how to fix them.
> +
> +**Problem 1**: You pushed to `main`, but your branch actually isn't called `main`
> +
> +Here's the error:
> +```
> +$ git push origin main
> +error: src refspec main does not match any
> +```
> +
> +This might happen if you didn't set `init.defaultBranch` to `main` in
> +<<step_2,Step 2>>.
> +
> +If you want to check the name of your current branch, you can run `git
> +status`. For example, in this output, the current branch is "master".
> +
> +-------------------------------------------
> +$ git status
> +On branch master
> +
> +...
> +-------------------------------------------
> +
> +To push your branch, you have a few options:
> +
> +* rename your branch to `main`, by running `git branch -m main`
> +  and then run `git push origin main`
> +* run `git push origin master`
> +  (where `master` is the name of your actual current branch)
> +
> +**Problem 2: SSH error**
> +
> +Here's the error:
> +
> +-----
> +$ git push origin main
> +The authenticity of host 'github.com (140.82.116.3)' can't be established.
> +ED25519 key fingerprint is: SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
> +This key is not known by any other names.
> +Are you sure you want to continue connecting (yes/no/[fingerprint])?
> +-----
> +
> +Git uses SSH to connect during `git push`, and this message happens when
> +SSH connects to a new site that you haven't connected to before.
> +
> +The easiest way to handle this is to type "yes" and press Enter.
> +
> +**Problem 3: the repository already exists**
> +
> +Here's the error:
> +
> +---------------------
> +$ git push origin main
> +! [rejected]        main -> main (fetch first)
> +error: failed to push some refs to 'example.com:example/example.git'
> +hint: Updates were rejected because the remote contains work that you do not
> +hint: have locally.
> +---------------------
> +
> +If you see an error like this, it means that when you created the
> +repository on your Git host, it created a repository with a file in it
> +to try to help you out. (that's the "work that you do not have locally"
> +in the error message)
> +
> +You can fix this either by deleting the repository and recreating it, or
> +by running:
> +
> +---------------------
> +$ git push --force origin main
> +---------------------
> +
> +**WARNING**: In general it's quite dangerous to use `--force` because
> +it can erase work on the online repository in a way that's difficult to
> +recover. But if you know for sure that you just created the repository 2
> +minutes ago and there's nothing in it, then it's okay.
> +
> +MORE USEFUL GIT COMMANDS
> +------------------------
> +
> +* To tell Git to "un-add" a file that you added by accident, run
> +  `git rm --cached FILENAME`
> +
> +SEE ALSO
> +--------
> +linkgit:git-help[1],
> +
> +GIT
> +---
> +Part of the linkgit:git[1] suite
> --
> gitgitgadget

Overall I think this is excellent (and I wish bottom-post replies
encouraged saying this up front, hm).

Thanks!

-- 
D. Ben Knoble

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] doc: add new Git tutorial for beginners
  2026-10-07 19:48   ` D. Ben Knoble
@ 2026-10-19 14:24     ` Julia Evans
  2026-10-19 16:49       ` Ben Knoble
  0 siblings, 1 reply; 15+ messages in thread
From: Julia Evans @ 2026-10-19 14:24 UTC (permalink / raw)
  To: D. Ben Knoble, Julia Evans; +Cc: git



On Wed, Oct 7, 2026, at 3:48 PM, D. Ben Knoble wrote:
> On Tue, Oct 6, 2026 at 3:37 PM Julia Evans via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>>
>> From: Julia Evans <julia@jvns.ca>
>>
>> This tutorial covers:
>>
>> 1. Creating an empty repo with `git init`
>> 2. Making commits with `git add`, `git commit`, `git diff`, and
>>    `git status`
>> 3. Pushing to code to a Git host on the internet, including creating an
>>    SSH key
>>
>> Signed-off-by: Julia Evans <julia@jvns.ca>
>> ---
>>  Documentation/gittutorial.adoc | 616 +++++++++++++++++++++++++++++++++
>>  1 file changed, 616 insertions(+)
>>  create mode 100644 Documentation/gittutorial.adoc
>>
>> diff --git a/Documentation/gittutorial.adoc b/Documentation/gittutorial.adoc
>> new file mode 100644
>> index 0000000000..617dbae096
>> --- /dev/null
>> +++ b/Documentation/gittutorial.adoc
>> @@ -0,0 +1,616 @@
>> +gittutorial(7)
>> +==============
>> +
>> +NAME
>> +----
>> +gittutorial - Introduction to Git for beginners
>> +
>> +DESCRIPTION
>> +-----------
>> +
>> +This tutorial explains how to import a project's code into Git, make
>> +changes to it, and upload the project to the Internet.
>> +
>> +We'll show you how to use the commands `git commit`, `git add`,
>> +`git diff`, `git status`, and `git push`.
>> +
>> +Command line vs GUI
>> +-------------------
>> +
>> +Git is a command line program, but there are many excellent GUIs for
>> +Git built by the community. For example, if you use an IDE to edit your
>> +code, it might already have a built-in Git integration that you can use.
>> +
>> +In this tutorial, we'll give instructions for the command line version
>> +of Git, but you can also follow along in a GUI. You can also do some
>> +tasks in a GUI and some tasks on the command line. It's up to you.
>
> Since we assume a *nix-ish environment, should we mention that this
> tutorial works best on UNIX-like OSs, or in a Git-for-Windows Bash
> environment, and may need adapting for folks using PowerShell, CMD, or
> some other userspace (not a piece of jargon I would use here,
> probably)? Or does that get covered incidentally by the installation
> instructions?
>
> I'm especially thinking of not confusing a user who sees something
> different or doesn't have an "ls", "cd", etc. (Maybe my Windows
> command line knowledge is shoddy, though, and those parts just kind of
> work close enough for our purposes?)

Yes, great idea, this also inspired me to recruit more Windows testers.
Added a mention of Git Bash.

>> +
>> +What we'll be doing
>> +-------------------
>> +
>> +Git lets you take snapshots of your code, like a checkpoint in a video
>> +game. In this tutorial we're going to explain a very basic Git
>> +workflow, which is:
>> +
>> +1. Create an empty folder
>> +2. Start using Git to manage the code in that folder
>> +3. Create 2 files and tell Git to save a snapshot of them
>> +4. Make changes to one of the files
>> +5. Tell Git to take another snapshot
>> +6. Repeat steps 4-5 any time you want to update your code
>
> I'm very tempted to nitpick "folder" vs "directory," but I'm not sure
> it's worth our time or that of the target audience :) Just note that,
> while "git grep folder" finds way more hits than I was expecting, it
> seems the primary use in our documentation is in reference to IMAP.

Yeah, I thought this might come up :) I don't have very strong feelings
here.

>> +We'll also explain how to use Git to put your code on the Internet.
>> +
>> +Step 1: Make sure Git is installed
>> +----------------------------------
>> +
>> +To do this tutorial, you'll need:
>> +
>> +1. Git to be installed. You might already have it installed,
>> +   and if not there are directions at https://git-scm.com/install/
>> +2. A folder on your computer with code that you want to start managing
>> +   with Git.
>> +
>> +You can check if Git is installed by running this in your terminal:
>> +
>> +------------------------------------------------
>> +$ git --version
>> +------------------------------------------------
>> +
>> +[[step_2]]
>> +Step 2: Introduce yourself to Git
>> +---------------------------------
>> +
>> +The first time you use Git on a computer, it's a good idea to tell Git
>> +your name and public email address. If you don't, you'll get a lot of
>> +warnings from Git. To do this, run:
>> +
>> +------------------------------------------------
>> +$ git config --global user.name "Namey McName"
>> +$ git config --global user.email you@example.com
>> +------------------------------------------------
>> +
>> +The name and email is so that other people you're collaborating with can
>> +know who made the changes. You can set them to anything you want.
>> +
>> +To check if the name and email have been set, you can run these
>> +commands:
>> +
>> +------------------------------------------------
>> +$ git config user.name
>> +$ git config user.email
>> +------------------------------------------------
>
> Ought we recommend the newer forms (git config set, git config get)?
> Or is the idea to remain compatible with older versions, such as the
> 2.32 I happen to have in /usr/bin on unsupported macOS 12.7.6 from
> very old (?) XCode?
>
>> +
>> +Set your default branch name to `main`, by running this command.
>> +Git is going to change its default branch name to `main` soon, so this
>> +sets you up well for the future.
>> +
>> +------------------------------------------------
>> +$ git config --global init.defaultBranch main
>> +------------------------------------------------
>> +
>> +If there's no output, then it succeeded.
>> +
>> +Step 3: Create an empty folder and 2 files
>> +------------------------------------------
>> +
>> +In your terminal, create an empty folder and change directories into it.
>> +Later on you could follow the same steps in this tutorial to take an
>> +existing project and start managing it with Git, but we're going to use
>> +an empty project so that everyone following this tutorial has the exact
>> +same files.
>> +
>> +For example, run these commands to make a folder called `myproject`
>> +
>> +------------------------------------------------
>> +$ mkdir myproject
>> +$ cd myproject
>> +------------------------------------------------
>
> I don't know, and I'll probably bias towards what you've already
> written over asking for changes, but: does it make things any easier
> to read and follow along with if we "git init myproject" instead?
> Perhaps this version plants the seed that it's not too late to start
> tracking any existing project, though, which is valuable :)
>
> I wonder if you had some rationale for choosing this particular
> sequence? Just curious, now.
>
>> +Create 2 files in this directory, so we have something to work with.
>> +
>> +Make a file called README.md, with these contents:
>> +
>> +------------------------------------------------
>> +We're doing a Git tutorial!
>> +We need 2 lines in this file so here's a second one
>> +------------------------------------------------
>> +
>> +And a file called `hello.py`, with these contents:
>> +
>> +------------------------------------------------
>> +print("hello world")
>> +------------------------------------------------
>> +
>> +Save the two files and keep them open in your text editor so you can
>> +easily edit them later. The exact contents aren't too important, but
>> +we'll use those contents in the example output later.
>> +
>> +You can check that the files are in the right place by running `ls`,
>> +like this:
>> +
>> +
>> +------------------------------------------------
>> +$ ls
>> +------------------------------------------------
>> +
>> +The output should be like this:
>> +
>> +------------------------------------------------
>> +hello.py
>> +README.md
>> +------------------------------------------------
>> +
>> +Step 4: Create a Git repository
>> +-------------------------------
>> +
>> +A Git repository is a folder which stores snapshots. It's usually a
>> +hidden folder called `.git`. Every time you take a snapshot, Git stores
>> +a copy of the contents of every file you're tracking.
>> +
>> +This might feel unbelievable, but Git uses compression so you can easily
>> +store tens of thousands of snapshots without using too much disk space.
>> +
>> +You can create a Git repository for any folder in your computer by
>> +running the command `git init`.
>> +
>> +Run `git init` in the folder you just created, like this:
>> +
>> +------------------------------------------------
>> +$ git init
>> +------------------------------------------------
>> +
>> +Git will reply:
>> +
>> +------------------------------------------------
>> +Initialized empty Git repository in .git/
>> +------------------------------------------------
>> +
>> +You might notice a new hidden folder was created, named `.git`.
>> +
>> +Step 5: Take your first snapshot
>> +--------------------------------
>> +
>> +Next, we're going to take a snapshot of all the files in the directory
>> +and tell Git to store them. Taking a snapshot in Git is a two step
>> +process: first you need to run `git add` and then `git commit`.
>> +
>> +The reason it's a two step process is that sometimes you might not
>> +actually want Git to store a snapshot of _all_ the files in a folder.
>> +For example, if you have a file full of private personal information
>> +called `personal.csv`, and a Python script called `process_data.py`, you
>> +might want Git to keep a snapshot of the Python script but not the
>> +private data.
>> +
>> +For now, we're going to store a snapshot of every file in your folder,
>> +as well as in every subfolder.
>> +
>> +The first step of creating a snapshot is to tell Git which files you
>> +want to include in the next snapshot using `git add`. To tell Git
>> +"include all files", run this command:
>> +
>> +------------------------------------------------
>> +$ git add .
>> +------------------------------------------------
>> +
>> +Next you can create the snapshot using the `git commit` command, like
>> +this. The `-m` flag stands for "message", and it lets you set a reminder
>> +for your future self of what you were doing. The message ("Initial
>> +commit" in this example) can say anything you want.
>> +
>> +------------------------------------------------
>> +$ git commit -m "Initial commit"
>> +------------------------------------------------
>> +
>> +You've now stored the first version of your project in Git! From now on
>> +we're going to use the word "commit" instead of "snapshot", since that's
>> +the term Git uses.
>
> I know we want to limit scope… but I would love to not accidentally
> encourage more use of "-m" for short (often useless?) messages.
> Unfortunately, that drags in the can of worms that is editor
> configuration. At least we can maybe point to
> https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup#_editor
> and 
> https://git-scm.com/book/en/v2/Appendix-C:-Git-Commands-Setup-and-Config#ch_core_editor
> ? idk.

Definitely editor configuration is an issue. I haven't worked out where to
put this yet. I think it's very important to warn users that Git will put you
into `vim` by default, because I think a lot of new Git users will not be
comfortable with vim. Feels like a sticky situation and I still don't quite
know what advice to give people if they aren't comfortable with a
terminal text editor. I think the options are:

- only use `-m` and only write short messages
- use something like `nano`
- use a GUI interface to Git instead, which lets you write commit
messages in a more familiar interface

I don't think we should be prescriptive about commit message length
since the importance of this really depends on the context.

>> +Step 6: Make a change
>> +---------------------
>> +
>> +Now, let's learn how to make a change to a file and review the change you made.
>> +In this example, we'll update the file `README.md`, but you can edit a
>> +different file.
>> +
>> +First open `README.md` in your favourite text editor, make a tiny or
>> +silly change, and save it.
>> +
>> +Next, in the terminal, run the command `git status` to get a summary of
>> +what you changed since the last Git commit.
>> +
>> +------------------------------------------------
>> +$ git status
>> +------------------------------------------------
>> +
>> +The output will look something like this:
>> +
>> +------------------------------------------------
>> +On branch main
>> +
>> +Changes not staged for commit:
>> +  (use "git add <file>..." to update what will be committed)
>> +  (use "git restore <file>..." to discard changes in working directory)
>> +        modified:   README.md
>> +------------------------------------------------
>> +
>> +This output says that we've changed `README.md` since the last time
>> +we committed.
>> +
>> +Next, if you want to see the details of how you've changed `README.md`,
>> +you can run `git diff`.
>> +
>> +------------------------------------------------
>> +$ git diff
>> +------------------------------------------------
>> +
>> +The output will look something like this:
>> +
>> +------------------------------------------------
>> +diff --git a/README.md b/README.md
>> +index 7ebaecb3..5a4ff712 100644
>> +--- a/README.md
>> ++++ b/README.md
>> +@@ -1,2 +1,2 @@
>> + Here are some Python scripts!
>> ++I hope you like them.
>> +------------------------------------------------
>> +
>> +This output says that we added one line, saying "I hope you like them.".
>> +By default Git will show the lines you removed in red, and the lines you
>> +added in green.
>
> I would perhaps prefer to focus on the leading sigils (-, +) than the
> color, if only because colorblindness can lead to all sorts of
> situations with different color setups in the terminal's palette or
> even (probably not our target audience) Git configuration. We could
> probably mention that Git shows added and removed lines in *different*
> colors without being too concerned with which colors those are? (That
> avoids having to twist our words like "your terminal palette's green
> and red" or w/e.)

Thanks, updated to mention the + and -.

>> +
>> +Step 7: Make another commit (easy way)
>> +--------------------------------------
>> +
>> +Now let's tell Git to save the new version of `README.md` by making
>> +another commit! To tell Git to snapshot all files that Git is tracking
>> +and commit them, run this command:
>> +
>> +------------------------------------------------
>> +$ git commit -am "Update README"
>> +------------------------------------------------
>> +
>> +This is similar to the two step process in Step 4 where we used `git
>> +add` and `git commit` to make a commit, but with a shortcut that lets
>> +you do both in just one command. The `-a` stands for "all".
>> +
>> +Step 7b: Make another commit (longer way)
>> +-----------------------------------------
>> +
>> +`git commit -am` is a fast way to snapshot all the files that Git is
>> +tracking. But if you want Git to ignore changes to certain files, you
>> +can instead do a 2-step process like in Step 4 where first you run `git
>> +add` for every file that's been changed and that you want to include in
>> +the next commit, like this:
>> +
>> +------------------------------------------------
>> +$ git add README.md
>> +------------------------------------------------
>> +
>> +and then run `git commit` (without the `-a`), like this:
>> +
>> +------------------------------------------------
>> +$ git commit -m "Update README"
>> +------------------------------------------------
>> +
>> +Step 8: Make a change and throw it away
>> +---------------------------------------
>> +
>> +One of the most useful things about Git is that it lets you safely
>> +experiment: you never need to be scared to change your code because you
>> +can always go back to the old version.
>> +
>> +Before starting to experiment, run `git status` to check the current
>> +state of your Git repository:
>> +
>> +------------------------------------------------
>> +$ git status
>> +On branch main
>> +
>> +nothing to commit, working tree clean
>> +------------------------------------------------
>> +
>> +This "working tree clean" message means that there haven't been any
>> +changes since your last commit.
>> +
>> +Now make a change to your code, and run `git status` again. Like last
>> +time, you should see a message like this:
>> +
>> +------------------------------------------------
>> +$ git status
>> +On branch main
>> +
>> +Changes not staged for commit:
>> +  (use "git add <file>..." to update what will be committed)
>> +  (use "git restore <file>..." to discard changes in working directory)
>> +        modified:   README.md
>> +------------------------------------------------
>> +
>> +This tells us that `README.md` has been changed since the last commit.
>> +But we don't actually want this change, so let's undo it! We can restore
>> +`README.md` back to how it was at the most recent commit using the `git
>> +restore` command.
>> +
>> +**WARNING**: `git restore` can't be reversed! Any time you run it it's
>> +important to be absolutely sure that you're okay with throwing away your
>> +changes since the last commit.
>> +
>> +------------------------------------------------
>> +$ git restore README.md
>> +------------------------------------------------
>> +
>> +Now open `README.md` again. You should see that your changes have been undone.
>> +
>> +You can stop here!
>> +------------------
>> +
>> +The commands we've learned so far (`git init`, `git add`, `git commit`,
>> +`git diff`, `git status`, and `git restore`) are enough to get a lot out
>> +of Git on their own.
>> +
>> +With these commands, you can keep copies of past versions of your code
>> +on your computer and safely experiment with big changes to your code.
>> +
>> +When using Git this way, all of your code just lives on your computer.
>> +But if you want to put your code on the Internet so that other people
>> +can use it or back it up, then you'll need to learn about one more
>> +command: `git push`.
>> +
>> +The rest of this tutorial is about how to upload your code to a Git
>> +repository on the Internet. The high level process is:
>> +
>> +1. Create an account on the Git host
>> +2. Configure Git so that it can login to the Git host to make changes
>> +3. Run `git push origin main` to upload your code
>> +
>> +Navigating the Git host's UI can be tricky, and it's hard for us to
>> +give you exact directions because the UIs change a lot.
>> +
>> +Step 9: Create an account on a Git host
>> +---------------------------------------
>> +
>> +To put your code on the Internet, you need it to be hosted somewhere.
>> +The easiest way to do this is to sign up with a Git host. There's a list
>> +of Git hosts (many of them offer free accounts) at
>> +https://git-scm.com/tools/hosting. GitHub and GitLab are two popular hosts.
>> +
>> +If you're comfortable running a server, there are other ways to host
>> +a Git repository on the internet, like connecting through SSH or open
>> +source Git forge software to your server.
>> +
>> +Step 10: Create an SSH key (if needed)
>> +-------------------------------------
>> +
>> +For Git to upload changes to another Git repository, it needs a way to
>> +login to that repository. One of the most popular ways to do this is
>> +with an SSH key.
>> +
>> +If you don't already have an SSH key, you'll need to create one. On Mac
>> +or Linux, you can check if you already have an SSH key by running:
>> +
>> +-------------------------------------------
>> +$ ls ~/.ssh/*.pub
>> +-------------------------------------------
>> +
>> +If you don't already have an SSH key, run:
>> +
>> +-------------------------------------------
>> +$ ssh-keygen
>> +-------------------------------------------
>> +
>> +`ssh-keygen` will ask you for some details.
>> +The easiest way to do this is to just press Enter at every prompt until
>> +it's done.
>> +
>> +NOTE: All of the advice about how to use SSH in this tutorial is aimed
>> +at getting it to work as quickly as possible. Setting up SSH in a secure
>> +way is very far outside the scope of this tutorial. If you have a
>> +security team in your organization, they might have very different
>> +opinions about the appropriate way to configure authentication with Git.
>> +
>> +Step 11: Tell the Git host your SSH public key
>> +----------------------------------------------
>> +
>> +First, find your SSH key like this (on Mac or Linux):
>> +
>> +-------------------------------------------
>> +$ ls ~/.ssh/*.pub
>> +-------------------------------------------
>> +
>> +That will output something like
>> +
>> +-------------------------------------------
>> +/home/alice/.ssh/id_ed25519.pub
>> +-------------------------------------------
>> +
>> +Copy the contents of that file to your clipboard. It's important that
>> +the filename ends in `.pub` ("pub" stands for "public").
>> +
>> +Then login to your account on the Git host you chose and paste the SSH
>> +key into the appropriate place. Depending on the Git host, it's likely
>> +under "SSH keys" in your settings. If it asks you what type of SSH key,
>> +look for something like "Authentication Key".
>> +
>> +Once you've done this, you're done! Git will automatically use your SSH
>> +key to try to connect.
>> +
>> +Step 12: Create an empty Git repository on the Git host
>> +-------------------------------------------------------
>> +
>> +Go to the Git host's website and create a new Git repository.
>> +
>> +**WARNING**: If you create a public repository and push your repository
>> +to it, then your name and email address, as well as the contents of
>> +any files you committed and every previous version of those files, will
>> +be on the public internet. Some Git hosts have the option to create
>> +a private repository instead, to keep your information private.
>> +
>> +Step 13: Find the address of the repository
>> +-------------------------------------------
>> +
>> +Now, find the address of the repository on your Git host. It should look
>> +something like this:
>> +
>> +-------------------------------------------
>> +git@git.example.com:username/repo.git
>> +-------------------------------------------
>> +
>> +(where `example.com`, `username` and `repo` will be replaced with the
>> +actual values).
>> +
>> +If you can only find an address starting with `https://`, then
>> +you can often translate it to the SSH format by replacing `https://`
>> +with `git@` and replacing the `/` after the domain name with an `:`.
>> +Here's how:
>> +
>> +-------------------------------------------
>> +https://git.example.com/username/repo
>> +^^^^^^^^               ^
>> +replace with "git@"    replace with ":"
>> +-------------------------------------------
>
> This is, of course, forge- and remote- dependent :) but I think it's
> *probably* ok for the tutorial.
>
> When you mentioned HTTPS-to-SSH translation, I was thinking of the
> config-based URL rewrite mechanism, aha! I definitely don't think we
> should go there ;)

Yeah, I thought about the config-based rewrites too and I don't think
we should mention it either :)

>> +
>> +Step 14: push your changes
>> +--------------------------
>> +
>> +Finally, we're ready to send the information in your local Git repository
>> +to the one on the internet!
>> +
>> +First, tell Git about the other repository by running `git remote add`
>> +in your terminal
>> +(replace `git@example.com:username/repo.git` with the actual address):
>> +
>> +-------------------------------------------
>> +$ git remote add origin git@example.com:username/repo.git
>> +-------------------------------------------
>> +
>> +This tells Git to save the URL `git@example.com:username/repo.git` in
>> +your Git repository's configuration under the name `origin`, so that you
>> +can use it later. If you make a mistake while doing this, you can run
>> +`git remote remove origin` and try again.
>> +
>> +Then tell Git to send the information, with `git push`
>> +(if this doesn't work, read the "Troubleshooting `git push`" section for advice!):
>> +
>> +-------------------------------------------
>> +$ git push -u origin main
>> +-------------------------------------------
>> +
>> +`origin` refers to the URL we just added (`git@example.com:username/repo.git`),
>> +and `main` is the name of your current Git branch. You can use any name
>> +(not just `origin`), but using `origin` often makes things easier
>> +because it's the default for `git push` and `git pull`.
>> +We haven't covered branches yet, but `main` is the default branch name.
>
> I'm not sure if we should recommend "-u" without being able to explain
> what it does, and… well… you and I have discussed how that's difficult
> :)
>
> Doesn't the tutorial's recipe of always using "git push origin main"
> work just fine? And if we later introduce pull and other
> branch-/remote-stuff that cares about upstreams, we can mention this
> shorthand then?

Yeah, many people asked what `-u` stands for, we added an explanation.
TBD how well that explanation lands though.

>> +
>> +Any time you want to set up a new repository, you can repeat steps
>> +11-13, with one exception: you only need to pass `-u` the first time
>> +you push. Afterwards you can just run the command:
>> +
>> +-------------------------------------------
>> +$ git push origin main
>> +-------------------------------------------
>> +
>> +It should output something like this:
>> +
>> +-------------------------------------------
>> +To example.com:example_username/example
>> + * [new branch]        main -> main
>> +-------------------------------------------
>> +
>> +Troubleshooting `git push`
>> +--------------------------
>> +
>> +There are 3 main errors you might run into when running `git push origin main`.
>> +Getting errors when running `git push` is actually a big part of using
>> +Git, so congratulations! If you get to this part of the tutorial, you
>> +get a little bonus experience in debugging.
>> +
>> +Here's a guide to why they're happening and how to fix them.
>> +
>> +**Problem 1**: You pushed to `main`, but your branch actually isn't called `main`
>> +
>> +Here's the error:
>> +```
>> +$ git push origin main
>> +error: src refspec main does not match any
>> +```
>> +
>> +This might happen if you didn't set `init.defaultBranch` to `main` in
>> +<<step_2,Step 2>>.
>> +
>> +If you want to check the name of your current branch, you can run `git
>> +status`. For example, in this output, the current branch is "master".
>> +
>> +-------------------------------------------
>> +$ git status
>> +On branch master
>> +
>> +...
>> +-------------------------------------------
>> +
>> +To push your branch, you have a few options:
>> +
>> +* rename your branch to `main`, by running `git branch -m main`
>> +  and then run `git push origin main`
>> +* run `git push origin master`
>> +  (where `master` is the name of your actual current branch)
>> +
>> +**Problem 2: SSH error**
>> +
>> +Here's the error:
>> +
>> +-----
>> +$ git push origin main
>> +The authenticity of host 'github.com (140.82.116.3)' can't be established.
>> +ED25519 key fingerprint is: SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
>> +This key is not known by any other names.
>> +Are you sure you want to continue connecting (yes/no/[fingerprint])?
>> +-----
>> +
>> +Git uses SSH to connect during `git push`, and this message happens when
>> +SSH connects to a new site that you haven't connected to before.
>> +
>> +The easiest way to handle this is to type "yes" and press Enter.
>> +
>> +**Problem 3: the repository already exists**
>> +
>> +Here's the error:
>> +
>> +---------------------
>> +$ git push origin main
>> +! [rejected]        main -> main (fetch first)
>> +error: failed to push some refs to 'example.com:example/example.git'
>> +hint: Updates were rejected because the remote contains work that you do not
>> +hint: have locally.
>> +---------------------
>> +
>> +If you see an error like this, it means that when you created the
>> +repository on your Git host, it created a repository with a file in it
>> +to try to help you out. (that's the "work that you do not have locally"
>> +in the error message)
>> +
>> +You can fix this either by deleting the repository and recreating it, or
>> +by running:
>> +
>> +---------------------
>> +$ git push --force origin main
>> +---------------------
>> +
>> +**WARNING**: In general it's quite dangerous to use `--force` because
>> +it can erase work on the online repository in a way that's difficult to
>> +recover. But if you know for sure that you just created the repository 2
>> +minutes ago and there's nothing in it, then it's okay.
>> +
>> +MORE USEFUL GIT COMMANDS
>> +------------------------
>> +
>> +* To tell Git to "un-add" a file that you added by accident, run
>> +  `git rm --cached FILENAME`
>> +
>> +SEE ALSO
>> +--------
>> +linkgit:git-help[1],
>> +
>> +GIT
>> +---
>> +Part of the linkgit:git[1] suite
>> --
>> gitgitgadget
>
> Overall I think this is excellent (and I wish bottom-post replies
> encouraged saying this up front, hm).
>
> Thanks!

Thanks for the review!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 0/2] doc: add new git tutorial
  2026-10-06 19:37 [PATCH 0/2] WIP: doc: add new git tutorial Julia Evans via GitGitGadget
                   ` (2 preceding siblings ...)
  2026-10-07 19:26 ` [PATCH 0/2] WIP: doc: add new git tutorial D. Ben Knoble
@ 2026-10-19 14:55 ` Julia Evans via GitGitGadget
  2026-10-19 14:55   ` [PATCH v2 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
                     ` (2 more replies)
  3 siblings, 3 replies; 15+ messages in thread
From: Julia Evans via GitGitGadget @ 2026-10-19 14:55 UTC (permalink / raw)
  To: git; +Cc: D. Ben Knoble, Julia Evans

So far we've gotten 112 comments from 30ish beta testers who have tried to
learn Git for the first using this tutorial. Most of them were able to
finish it successfully. By far the most common piece of feedback was that
people want to learn more about collaboration and branching. I've written a
draft of a tutorial on branching, but this is already quite a lot of words
so definitely we can't cover it in this series.

I don't know if it's possible to get this merged quickly, but if it were I
think it would be amazing since people are so eager for a tutorial on
branching. If we spend a huge amount of time revising this I think there's a
real risk I'll run out of funding before we have time to write about
branching. Ideally I think it would be great if we could merge a "good
enough" version and then have a way on the website for users to give
feedback on it, so that we can later incorporate that feedback and
iteratively make it better over time.

Here's all the "any other feedback?" comments that people left on the
tutorial (positive and negative), just to give a feeling for the overall
sentiment. I thought it was surprising but great that several people
described the tutorial as short or quick, because there are 14 steps and the
document is a bit long. this was feedback that people left as we were making
revisions, so some of it was on previous versions of the tutorial.

"I really enjoyed the tutorial. It didn't use too many words, when not
necessary and was precise, which I find appealing. The short explanations
were insightful and just the amount of information I was looking for (e.g.
that -m stands for message). I was looking for an easy tutorial that would
stretch just a little into collaboration, which I did not find here. Since I
already started learning git now, I will try to get there myself. So maybe
that's all I needed? I'll see. What this tutorial did to is take fear. At
least for me. I did get the hang of these commands in a short time, so I
want to keep going."

I have failed to learn to use git on a couple of previous occasions. This
was a really good way of stripping it down to the essentials. I think now
that my problem is that I speak English. This document is mostly written in
English, successfully enough that "make a commit" was the only part where
screeched to a halt. At the command line, "commit" was a verb again, so I
could proceed without confusion.

Thank you for your work.

Thank you for the tutorial

At first I was not sure I liked the long scrolling page. I'm still not sure
I like it. I thought the content was good for someone new to git. We never
did anything with the python file, so I found it odd we made it? (note from
julia: removed the python file in response to this)

This was a great tutorial and very easy to follow. Thank you!

A few explanations about why you do things would go a long way to make this
more useful

Sorry about the confusion, I jump around a lot so things admittedly get
jumbled..."

"aaaaa sorry i misremembered the ssh trouble I was having, my problem was
that the command in the tutorial didn't work for me so I just used the
regular url and entered my password... then looked up somewhere else how to
generate the ssh key later.

not at this time!! thank you for the tutorial :)

I think the tutorial is great ! It was very clear and the step by step is
well done

i will keep practicing using git and maybe some more good reasons will
appear in why should do revision control in this way. it has got me to make
more test cases.

Solid tutorial. Some topics took me 2 reads to get a grasp of but that may
be due to English not being my native language

I learned something new with "git -am" - all in all this was concise and
easy to follow. Thank you for your work!

It is short and felt quick. That my be good. But I would have liked to
continue for a bit more before I start using it more and collect practical
experience.

I would add that I was taking notes in a notebook while doing the tutorial
(I would also do it in a final tutorial), so maybe it took me more time. I
also wanted to thank you, I feel I got a structured knowledge.

What I was hoping to find is how to work with git in a team. When should I
merge, when should I branch, basically; how am I a good git-citizen

Thank you so much for the opportunity to participate! I learned a lot,
especially from the top offline section.

that was very useful. "git diff" or any "diff" i still find hard on the
eyes, but I noticed in my terminal it was different colors which helped me
work out the info that was being presented. I think in the past it was all
one color which made it harder to absorb. But so far so good. Thank you. I
learnt new stuff today.

Overall, I liked this tutorial a lot. I've done a bit with Git before and
never felt comfortable. Now I feel a bit more confident. I'm also open to
testing more and answering questions anytime you need. And "Thanks". Every
little bit I learn helps.

Overall though I really like the tutorial, it's easy to follow and I learned
a lot!

Julia Evans (2):
  doc: remove gittutorial
  doc: add new Git tutorial for beginners

 Documentation/gittutorial.adoc | 944 ++++++++++++++++++---------------
 1 file changed, 506 insertions(+), 438 deletions(-)


base-commit: c51408889c3b372814bc20b9431c3b74d0d268eb
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2248%2Fjvns%2Fgit-tutorial-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2248/jvns/git-tutorial-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2248

Range-diff vs v1:

 1:  d47c730431 ! 1:  42035aa84a doc: remove gittutorial
     @@ Documentation/gittutorial.adoc (deleted)
      -----
      -gittutorial - A tutorial introduction to Git
      -
     --SYNOPSIS
     ----------
     --[verse]
     --git *
     --
      -DESCRIPTION
      ------------
      -
 2:  41dca2e8e0 ! 2:  6532e60e30 doc: add new Git tutorial for beginners
     @@ Metadata
       ## Commit message ##
          doc: add new Git tutorial for beginners
      
     -    This tutorial covers:
     +    Introduce Git in two parts:
      
     -    1. Creating an empty repo with `git init`
     -    2. Making commits with `git add`, `git commit`, `git diff`, and
     -       `git status`
     -    3. Pushing to code to a Git host on the internet, including creating an
     -       SSH key
     +    Steps 1-7: Create an empty repo & make 2 commits (`git init`,
     +    `git add`, `git commit`, `git status`, `git diff`)
     +    Steps 8-12: Push the repo to a remote host like GitHub or GitLab
     +    (`git remote add`, `git push`)
      
     +    Some design choices:
     +
     +    - Introduce a much smaller set of commands than the old tutorial, to
     +      keep the tutorial quick (doable in an hour). Some users found it to be
     +      very fast and some wanted to stop early (after step 7) so this seems
     +      to be a good balance.
     +    - Have users start with an empty repository instead of an existing
     +      project, because many of the testers did not have an existing project
     +      to test, or were scared of using an existing project.
     +    - Add a troubleshooting section, since in the testing some users got
     +      extremely stuck (for 4+ hours) on minor issues like needing to say
     +      "yes" when SSHing to a new host.
     +    - Don't explain branches, because explaining branches and collaboration
     +      is complicated and deserves its own tutorial. Instead just tell users
     +      we're not going to explain them in this document.
     +    - Tell users to set their default branch to `main`, because many Git
     +      hosts use it as their default branch and it really simplifies things.
     +    - Keep it as vendor neutral as possible, while acknowledging the reality
     +      that Git hosting services like GitHub, GitLab, etc are extremely
     +      popular. Do this by creating the repo locally and then optionally
     +      pushing it later.
     +    - Use SSH for authentication, explaining how to set up SSH in the
     +      easiest way possible (with disclaimers to check your security team's
     +      policy if applicable since the "easiest way" may not be the best), and
     +      giving some instructions for how to translate an HTTPS URL to an SSH
     +      URL.
     +
     +    At least 20 people have successfully completed it, and feedback was
     +    incorporated from problems the testers ran into.
     +
     +    Co-authored-by: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
     +    Signed-off-by: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
          Signed-off-by: Julia Evans <julia@jvns.ca>
      
       ## Documentation/gittutorial.adoc (new) ##
     @@ Documentation/gittutorial.adoc (new)
      +DESCRIPTION
      +-----------
      +
     -+This tutorial explains how to import a project's code into Git, make
     -+changes to it, and upload the project to the Internet.
     ++Git is a program that lets you collaborate with others on code, back up
     ++your code, roll back to an earlier version of your project, track how
     ++your project has changed over time, and much more.
     ++
     ++This tutorial explains how to create a new Git project, make
     ++changes to it, and upload the project to the Internet. It usually takes
     ++less than an hour if you have a little previous experience with Git, and
     ++1-2 hours if not.
      +
      +We'll show you how to use the commands `git commit`, `git add`,
      +`git diff`, `git status`, and `git push`.
      +
     -+Command line vs GUI
     -+-------------------
     -+
     -+Git is a command line program, but there are many excellent GUIs for
     -+Git built by the community. For example, if you use an IDE to edit your
     -+code, it might already have a built-in Git integration that you can use.
     -+
     -+In this tutorial, we'll give instructions for the command line version
     -+of Git, but you can also follow along in a GUI. You can also do some
     -+tasks in a GUI and some tasks on the command line. It's up to you.
     -+
      +What we'll be doing
      +-------------------
      +
      +Git lets you take snapshots of your code, like a checkpoint in a video
     -+game. In this tutorial we're going to explain a very basic Git
     -+workflow, which is:
     ++game. These snapshots are called "commits". Which files to save in a
     ++commit is up to you.
     ++
     ++When Git stores a commit, it stores a copy of every file in the commit
     ++in a database in a directory called `.git`. This is called a "Git repository".
      +
     -+1. Create an empty folder
     -+2. Start using Git to manage the code in that folder
     -+3. Create 2 files and tell Git to save a snapshot of them
     -+4. Make changes to one of the files
     -+5. Tell Git to take another snapshot
     -+6. Repeat steps 4-5 any time you want to update your code
     ++In this tutorial we're going to show you how to:
     ++
     ++1. Create a Git repository in a directory with the command `git init`.
     ++   This creates the `.git` directory where Git stores all your commits.
     ++2. Tell Git which files you want to put in a commit
     ++3. Make a commit
     ++4. Change a file and make a new commit with the new version
     ++5. Make experimental changes and throw them away
      +
      +We'll also explain how to use Git to put your code on the Internet.
      +
     ++Command line vs graphical interfaces
     ++------------------------------------
     ++
     ++Git is a command line program, but there are many graphical interfaces
     ++for Git built by the community. Your text editor might even have a
     ++built-in Git integration.
     ++
     ++In this tutorial, we'll give instructions for using Git from the
     ++command line. We can't give you instructions for how to do it in your
     ++graphical interface because there are so many of them.
     ++
     ++You can always switch back and forth between using the command line and
     ++a graphical interface at any time.
     ++
      +Step 1: Make sure Git is installed
      +----------------------------------
      +
     @@ Documentation/gittutorial.adoc (new)
      +
      +1. Git to be installed. You might already have it installed,
      +   and if not there are directions at https://git-scm.com/install/
     -+2. A folder on your computer with code that you want to start managing
     -+   with Git.
     ++2. A terminal to use. On Windows, you can use Git Bash which comes
     ++   when you install Git.
      +
      +You can check if Git is installed by running this in your terminal:
      +
     @@ Documentation/gittutorial.adoc (new)
      +$ git --version
      +------------------------------------------------
      +
     ++It should output something like this:
     ++
     ++------------------------------------------------
     ++git version 2.54.0
     ++------------------------------------------------
     ++
     ++The exact version isn't too important: this tutorial is designed to work
     ++with any version of Git after 2.0.
     ++
      +[[step_2]]
      +Step 2: Introduce yourself to Git
      +---------------------------------
     @@ Documentation/gittutorial.adoc (new)
      +$ git config --global user.email you@example.com
      +------------------------------------------------
      +
     -+The name and email is so that other people you're collaborating with can
     -+know who made the changes. You can set them to anything you want.
     ++The name and email is so that other people you're collaborating with
     ++can know who made the changes. You can set them to anything you want.
      +
      +To check if the name and email have been set, you can run these
     -+commands:
     ++commands. They should display your name and email:
      +
      +------------------------------------------------
      +$ git config user.name
      +$ git config user.email
      +------------------------------------------------
      +
     -+Set your default branch name to `main`, by running this command.
     -+Git is going to change its default branch name to `main` soon, so this
     -+sets you up well for the future.
     ++Next, configure Git to set the default branch name to `main` (instead
     ++of `master`) by running this command. We can't explain what a branch is
     ++yet, but Git is going to
     ++https://sfconservancy.org/news/2020/jun/23/gitbranchname/[make `main` the default soon],
     ++and setting this avoids some extremely annoying problems in Step 14.
      +
      +------------------------------------------------
      +$ git config --global init.defaultBranch main
     @@ Documentation/gittutorial.adoc (new)
      +
      +If there's no output, then it succeeded.
      +
     -+Step 3: Create an empty folder and 2 files
     ++[NOTE]
     ++It's also possible to set a different email address for every project,
     ++but we're not covering that here.
     ++
     ++Step 3: Create an empty folder and 1 file
      +------------------------------------------
      +
      +In your terminal, create an empty folder and change directories into it.
     @@ Documentation/gittutorial.adoc (new)
      +$ cd myproject
      +------------------------------------------------
      +
     -+Create 2 files in this directory, so we have something to work with.
     ++Next, using your text editor, create a file in this directory, so we
     ++have something to work with.
      +
      +Make a file called README.md, with these contents:
      +
     @@ Documentation/gittutorial.adoc (new)
      +We need 2 lines in this file so here's a second one
      +------------------------------------------------
      +
     -+And a file called `hello.py`, with these contents:
     -+
     -+------------------------------------------------
     -+print("hello world")
     -+------------------------------------------------
     -+
     -+Save the two files and keep them open in your text editor so you can
     -+easily edit them later. The exact contents aren't too important, but
     ++Save `README.md` and keep it open in your text editor so you can
     ++easily edit it later. The exact contents aren't too important, but
      +we'll use those contents in the example output later.
      +
     -+You can check that the files are in the right place by running `ls`,
     ++You can check that the file is in the right place by running `ls`,
      +like this:
      +
     -+
      +------------------------------------------------
      +$ ls
      +------------------------------------------------
      +
     -+The output should be like this:
     ++The output should look like this:
      +
      +------------------------------------------------
     -+hello.py
      +README.md
      +------------------------------------------------
      +
      +Step 4: Create a Git repository
      +-------------------------------
      +
     -+A Git repository is a folder which stores snapshots. It's usually a
     -+hidden folder called `.git`. Every time you take a snapshot, Git stores
     -+a copy of the contents of every file you're tracking.
     ++A Git repository lets you save snapshots of your code. Every time you make a
     ++snapshot, Git stores a copy of the contents of every file in the snapshot.
      +
      +This might feel unbelievable, but Git uses compression so you can easily
      +store tens of thousands of snapshots without using too much disk space.
     @@ Documentation/gittutorial.adoc (new)
      +------------------------------------------------
      +
      +You might notice a new hidden folder was created, named `.git`.
     ++You don't need to use this folder directly in any way, but it's where
     ++your commits will be stored.
      +
     -+Step 5: Take your first snapshot
     -+--------------------------------
     ++Step 5: Make your first commit
     ++------------------------------
      +
      +Next, we're going to take a snapshot of all the files in the directory
     -+and tell Git to store them. Taking a snapshot in Git is a two step
     -+process: first you need to run `git add` and then `git commit`.
     ++and tell Git to store them. Git calls these snapshots "commits".
     ++Making a commit in Git is a two step process: first you need to run `git
     ++add` and then `git commit`.
      +
      +The reason it's a two step process is that sometimes you might not
     -+actually want Git to store a snapshot of _all_ the files in a folder.
     -+For example, if you have a file full of private personal information
     -+called `personal.csv`, and a Python script called `process_data.py`, you
     -+might want Git to keep a snapshot of the Python script but not the
     -+private data.
     ++actually want Git to store a commit with _all_ the files in a folder.
     ++For example, if you're compiling your program to a binary, you might
     ++want Git to put the program's source code in your commit but not
     ++compiled binary. You can also use a `.gitignore` file to help with this.
      +
     -+For now, we're going to store a snapshot of every file in your folder,
     ++For now, we're going to store a commit with every file in your folder,
      +as well as in every subfolder.
      +
     -+The first step of creating a snapshot is to tell Git which files you
     -+want to include in the next snapshot using `git add`. To tell Git
     ++The first step of making a commit is to tell Git which files you
     ++want to include in the commit using `git add`. To tell Git
      +"include all files", run this command:
      +
      +------------------------------------------------
      +$ git add .
      +------------------------------------------------
      +
     -+Next you can create the snapshot using the `git commit` command, like
     -+this. The `-m` flag stands for "message", and it lets you set a reminder
     -+for your future self of what you were doing. The message ("Initial
     -+commit" in this example) can say anything you want.
     ++To check if it succeeded, you can run `git status`.
     ++The output should look like this:
     ++
     ++
     ++------------------------------------------------
     ++$ git status
     ++On branch main
     ++
     ++No commits yet
     ++
     ++Changes to be committed:
     ++  (use "git rm --cached <file>..." to unstage)
     ++        new file:   README.md
     ++------------------------------------------------
     ++
     ++Next you can create the commit using the `git commit` command, like
     ++this:
      +
      +------------------------------------------------
      +$ git commit -m "Initial commit"
      +------------------------------------------------
      +
     -+You've now stored the first version of your project in Git! From now on
     -+we're going to use the word "commit" instead of "snapshot", since that's
     -+the term Git uses.
     ++The `-m` flag stands for "message", and it lets you set a reminder
     ++for your future self of what you were doing. The message
     ++("Initial commit" in this example) can say anything you want.
     ++
     ++The output should look like this:
     ++
     ++------------------------------------------------
     ++[main (root-commit) 4a7e367] Initial commit
     ++ 1 file changed, 2 insertions(+)
     ++ create mode 100644 README.md
     ++------------------------------------------------
     ++
     ++You've now stored the first version of your project in Git!
      +
      +Step 6: Make a change
      +---------------------
     @@ Documentation/gittutorial.adoc (new)
      +different file.
      +
      +First open `README.md` in your favourite text editor, make a tiny or
     -+silly change, and save it.
     ++silly change, and save it. In our example, we'll edit the first line to
     ++add more exclamation marks:
     ++
     ++------------------------------------------------
     ++We're doing a Git tutorial!!!!
     ++------------------------------------------------
     ++
      +
      +Next, in the terminal, run the command `git status` to get a summary of
      +what you changed since the last Git commit.
     @@ Documentation/gittutorial.adoc (new)
      +
      +------------------------------------------------
      +diff --git a/README.md b/README.md
     -+index 7ebaecb3..5a4ff712 100644
     ++index ffa8b85..a49e4b0 100644
      +--- a/README.md
      ++++ b/README.md
      +@@ -1,2 +1,2 @@
     -+ Here are some Python scripts!
     -++I hope you like them.
     ++-We're doing a Git tutorial!
     +++We're doing a Git tutorial!!!!
     ++ We need 2 lines in this file so here's a second one
      +------------------------------------------------
      +
     -+This output says that we added one line, saying "I hope you like them.".
     -+By default Git will show the lines you removed in red, and the lines you
     -+added in green.
     ++This output says that we deleted one line (`We're doing a Git
     ++tutorial!`) and added one line (`We're doing a Git tutorial!!!!`). By
     ++default Git will show the lines you removed in red, and the lines you
     ++added in green. Removed lines start with a minus `-` and added lines
     ++start with a plus `+`.
     ++
     ++Step 7a: Make a second commit
     ++-----------------------------
      +
     -+Step 7: Make another commit (easy way)
     -+--------------------------------------
     ++Now that we've changed `README.md`, let's make another commit.
     ++We're going to follow the same steps as before when we made our first
     ++commit.
      +
     -+Now let's tell Git to save the new version of `README.md` by making
     -+another commit! To tell Git to snapshot all files that Git is tracking
     -+and commit them, run this command:
     ++First, tell Git that we want to include the new version of `README.md`
     ++in the next commit:
      +
      +------------------------------------------------
     -+$ git commit -am "Update README"
     ++$ git add README.md
      +------------------------------------------------
      +
     -+This is similar to the two step process in Step 4 where we used `git
     -+add` and `git commit` to make a commit, but with a shortcut that lets
     -+you do both in just one command. The `-a` stands for "all".
     ++and then run `git commit`, like this:
      +
     -+Step 7b: Make another commit (longer way)
     -+-----------------------------------------
     ++------------------------------------------------
     ++$ git commit -m "Update README"
     ++------------------------------------------------
      +
     -+`git commit -am` is a fast way to snapshot all the files that Git is
     -+tracking. But if you want Git to ignore changes to certain files, you
     -+can instead do a 2-step process like in Step 4 where first you run `git
     -+add` for every file that's been changed and that you want to include in
     -+the next commit, like this:
     ++The output should look like this:
      +
      +------------------------------------------------
     -+$ git add README.md
     ++[main 32e0171] Update README
     ++ 1 file changed, 1 insertion(+), 1 deletion(-)
      +------------------------------------------------
      +
     -+and then run `git commit` (without the `-a`), like this:
     ++This says that the new commit is the same as the previous commit,
     ++except that we changed 1 line of 1 file.
     ++
     ++Step 7b: Make a second commit (the short way)
     ++---------------------------------------------
     ++
     ++Instead of running the two commands in Step 7a above, you
     ++could also run this command as a shortcut. It will:
     ++
     ++1. Get a list of every file in the most recent commit
     ++2. Commit the current version of all of those files
      +
      +------------------------------------------------
     -+$ git commit -m "Update README"
     ++$ git commit -am "Update README"
      +------------------------------------------------
      +
     ++The `-a` stands for "all".
     ++
     ++Understanding `git status` output: "untracked files"
     ++----------------------------------------------------
     ++
     ++Now let's talk about a term you'll see in the `git status` output:
     ++"untracked files".
     ++
     ++First create a new file called `example.txt`. It can be empty.
     ++
     ++Then run the command `git status`. You should see this output:
     ++
     ++----------
     ++On branch main
     ++
     ++Untracked files:
     ++  (use "git add <file>..." to include in what will be committed)
     ++        example.txt
     ++
     ++nothing added to commit but untracked files present (use "git add" to track)
     ++----------
     ++
     ++This has a list of "untracked files". An untracked file is a file which
     ++was not part of the latest commit. By default Git will ignore these
     ++files.
     ++
     ++If you want to commit an untracked file, you can add it like this:
     ++
     ++----------
     ++$ git add example.txt
     ++----------
     ++
     ++Then you can run `git commit` to commit it.
     ++
      +Step 8: Make a change and throw it away
      +---------------------------------------
      +
     @@ -1,2 +1,2 @@
      +
      +Navigating the Git host's UI can be tricky, and it's hard for us to
      +give you exact directions because the UIs change a lot.
     ++There's a rich tradition of people learning Git from their "Git friend"
     ++who already knows Git, and if you have one of those it might be useful
     ++to ask them if you get stuck. There are many ways to do things in Git,
     ++so they might suggest a slightly different way.
     ++There's also a troubleshooting guide at the end with the most common
     ++issues folks have run into while doing this tutorial.
      +
      +Step 9: Create an account on a Git host
      +---------------------------------------
     @@ -1,2 +1,2 @@
      +Once you've done this, you're done! Git will automatically use your SSH
      +key to try to connect.
      +
     ++[[step_12]]
      +Step 12: Create an empty Git repository on the Git host
      +-------------------------------------------------------
      +
     -+Go to the Git host's website and create a new Git repository.
     ++Go to the Git host's website and create a new Git repository. If there's
     ++an option to "create a README.md", "add a license", or something
     ++similar, make sure to say no to all of them.
      +
      +**WARNING**: If you create a public repository and push your repository
      +to it, then your name and email address, as well as the contents of
     @@ -1,2 +1,2 @@
      +replace with "git@"    replace with ":"
      +-------------------------------------------
      +
     ++[[step_14]]
      +Step 14: push your changes
      +--------------------------
      +
     @@ -1,2 +1,2 @@
      +(if this doesn't work, read the "Troubleshooting `git push`" section for advice!):
      +
      +-------------------------------------------
     -+$ git push -u origin main
     ++$ git push --set-upstream origin main
      +-------------------------------------------
      +
     -+`origin` refers to the URL we just added (`git@example.com:username/repo.git`),
     -+and `main` is the name of your current Git branch. You can use any name
     -+(not just `origin`), but using `origin` often makes things easier
     -+because it's the default for `git push` and `git pull`.
     -+We haven't covered branches yet, but `main` is the default branch name.
     ++Let's break down this `git push` command:
      +
     -+Any time you want to set up a new repository, you can repeat steps
     -+11-13, with one exception: you only need to pass `-u` the first time
     -+you push. Afterwards you can just run the command:
     ++* `origin` refers to the Git repository that we just added with
     ++  `git remote add` (`git@example.com:username/repo.git`).
     ++  You can use any name (not just `origin`), but using `origin` often
     ++  makes things easier because it's the default for `git push` and `git pull`.
     ++* `main` is the name of your current Git branch.
     ++  We haven't covered branches yet, but `main` is the default branch name.
     ++* `--set-upstream` tells Git to make this the default for `git push` for
     ++  the `main` branch. After you set the upstream, `git status` will
     ++  also tell you if you have commits that haven't been pushed.
     ++
     ++The output should look like this:
      +
      +-------------------------------------------
     -+$ git push origin main
     ++Enumerating objects: 7, done.
     ++Counting objects: 100% (7/7), done.
     ++Delta compression using up to 8 threads
     ++Compressing objects: 100% (6/6), done.
     ++Writing objects: 100% (7/7), 662 bytes | 662.00 KiB/s, done.
     ++Total 7 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
     ++To example.com:username/repo
     ++ * [new branch]      main -> main
     ++branch 'main' set up to track 'origin/main'.
      +-------------------------------------------
      +
     -+It should output something like this:
     ++Any time you want to set up a new repository, you can repeat steps
     ++12-14, with one exception: you only need to pass `--set-upstream` the first time
     ++you push. Afterwards you can just run the command:
      +
     -+-------------------------------------------
     -+To example.com:example_username/example
     -+ * [new branch]        main -> main
     -+-------------------------------------------
     ++-------
     ++$ git push origin main
     ++-------
      +
      +Troubleshooting `git push`
      +--------------------------
     @@ -1,2 +1,2 @@
      +
      +Here's a guide to why they're happening and how to fix them.
      +
     -+**Problem 1**: You pushed to `main`, but your branch actually isn't called `main`
     ++**Problem 1: You pushed to `main`, but your branch actually isn't called `main`**
      +
      +Here's the error:
     -+```
     ++
     ++-------
      +$ git push origin main
      +error: src refspec main does not match any
     -+```
     ++-------
      +
      +This might happen if you didn't set `init.defaultBranch` to `main` in
      +<<step_2,Step 2>>.
     @@ -1,2 +1,2 @@
      +
      +The easiest way to handle this is to type "yes" and press Enter.
      +
     -+**Problem 3: the repository already exists**
     ++**Problem 3: the repository already has commits in it**
      +
      +Here's the error:
      +
      +---------------------
      +$ git push origin main
      +! [rejected]        main -> main (fetch first)
     -+error: failed to push some refs to 'example.com:example/example.git'
     ++error: failed to push some refs to 'example.com:username/repo.git'
      +hint: Updates were rejected because the remote contains work that you do not
      +hint: have locally.
      +---------------------
      +
      +If you see an error like this, it means that when you created the
     -+repository on your Git host, it created a repository with a file in it
     -+to try to help you out. (that's the "work that you do not have locally"
     -+in the error message)
     ++repository on your Git host, it added a commit to try to help you out.
     ++That's the "work that you do not have locally" in the error message.
      +
     -+You can fix this either by deleting the repository and recreating it, or
     -+by running:
     -+
     -+---------------------
     -+$ git push --force origin main
     -+---------------------
     -+
     -+**WARNING**: In general it's quite dangerous to use `--force` because
     -+it can erase work on the online repository in a way that's difficult to
     -+recover. But if you know for sure that you just created the repository 2
     -+minutes ago and there's nothing in it, then it's okay.
     ++You should be able to fix this by redoing <<step_12,Step 12>>.
     ++Then <<step_14,Step 14>> should work.
      +
      +MORE USEFUL GIT COMMANDS
      +------------------------
      +
     ++We're not going to cover collaboration at all in this tutorial, but here are a
     ++few more commands that might be useful when using Git on your own:
     ++
     ++* To download a Git repository to use on your computer you can run
     ++  `git clone https://example.com/some/repo` (linkgit:git-clone[1]).
      +* To tell Git to "un-add" a file that you added by accident, run
     -+  `git rm --cached FILENAME`
     ++  `git rm --cached FILENAME` (linkgit:git-rm[1])
     ++* To get a list of past commits, run `git log` (linkgit:git-log[1])
     ++* Every commit has an ID that looks something like this:
     ++  `497588f53141b531a59ed888c7d2d9b8f8a6742d`.
     ++  If you see a commit with `git log` that you want more details about,
     ++  you can run `git show COMMIT_ID` to see what changes that made since
     ++  the previous commit (linkgit:git-show[1])
      +
      +SEE ALSO
      +--------

-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/2] doc: remove gittutorial
  2026-10-19 14:55 ` [PATCH v2 0/2] " Julia Evans via GitGitGadget
@ 2026-10-19 14:55   ` Julia Evans via GitGitGadget
  2026-10-19 14:55   ` [PATCH v2 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
  2026-10-20  1:24   ` [PATCH v2 0/2] doc: add new git tutorial Junio C Hamano
  2 siblings, 0 replies; 15+ messages in thread
From: Julia Evans via GitGitGadget @ 2026-10-19 14:55 UTC (permalink / raw)
  To: git; +Cc: D. Ben Knoble, Julia Evans, Julia Evans

From: Julia Evans <julia@jvns.ca>

The next commit replaces it with a new tutorial.

Do this as a remove/add instead of just replacing the file in a single
commit to make the patches easier to read on the mailing list, since the
existing content isn't being reused.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/gittutorial.adoc | 671 ---------------------------------
 1 file changed, 671 deletions(-)
 delete mode 100644 Documentation/gittutorial.adoc

diff --git a/Documentation/gittutorial.adoc b/Documentation/gittutorial.adoc
deleted file mode 100644
index 03120ba191..0000000000
--- a/Documentation/gittutorial.adoc
+++ /dev/null
@@ -1,671 +0,0 @@
-gittutorial(7)
-==============
-
-NAME
-----
-gittutorial - A tutorial introduction to Git
-
-DESCRIPTION
------------
-
-This tutorial explains how to import a new project into Git, make
-changes to it, and share changes with other developers.
-
-If you are instead primarily interested in using Git to fetch a project,
-for example, to test the latest version, you may prefer to start with
-the first two chapters of link:user-manual.html[The Git User's Manual].
-
-First, note that you can get documentation for a command such as
-`git log --graph` with:
-
-------------------------------------------------
-$ man git-log
-------------------------------------------------
-
-or:
-
-------------------------------------------------
-$ git help log
-------------------------------------------------
-
-With the latter, you can use the manual viewer of your choice; see
-linkgit:git-help[1] for more information.
-
-It is a good idea to introduce yourself to Git with your name and
-public email address before doing any operation.  The easiest
-way to do so is:
-
-------------------------------------------------
-$ git config --global user.name "Your Name Comes Here"
-$ git config --global user.email you@yourdomain.example.com
-------------------------------------------------
-
-
-Importing a new project
------------------------
-
-Assume you have a tarball `project.tar.gz` with your initial work.  You
-can place it under Git revision control as follows.
-
-------------------------------------------------
-$ tar xzf project.tar.gz
-$ cd project
-$ git init
-------------------------------------------------
-
-Git will reply
-
-------------------------------------------------
-Initialized empty Git repository in .git/
-------------------------------------------------
-
-You've now initialized the working directory--you may notice a new
-directory created, named `.git`.
-
-Next, tell Git to take a snapshot of the contents of all files under the
-current directory (note the `.`), with `git add`:
-
-------------------------------------------------
-$ git add .
-------------------------------------------------
-
-This snapshot is now stored in a temporary staging area which Git calls
-the "index".  You can permanently store the contents of the index in the
-repository with `git commit`:
-
-------------------------------------------------
-$ git commit
-------------------------------------------------
-
-This will prompt you for a commit message.  You've now stored the first
-version of your project in Git.
-
-Making changes
---------------
-
-Modify some files, then add their updated contents to the index:
-
-------------------------------------------------
-$ git add file1 file2 file3
-------------------------------------------------
-
-You are now ready to commit.  You can see what is about to be committed
-using `git diff` with the `--cached` option:
-
-------------------------------------------------
-$ git diff --cached
-------------------------------------------------
-
-(Without `--cached`, `git diff` will show you any changes that
-you've made but not yet added to the index.)  You can also get a brief
-summary of the situation with `git status`:
-
-------------------------------------------------
-$ git status
-On branch master
-Changes to be committed:
-  (use "git restore --staged <file>..." to unstage)
-
-	modified:   file1
-	modified:   file2
-	modified:   file3
-
-------------------------------------------------
-
-If you need to make any further adjustments, do so now, and then add any
-newly modified content to the index.  Finally, commit your changes with:
-
-------------------------------------------------
-$ git commit
-------------------------------------------------
-
-This will again prompt you for a message describing the change, and then
-record a new version of the project.
-
-Alternatively, instead of running `git add` beforehand, you can use
-
-------------------------------------------------
-$ git commit -a
-------------------------------------------------
-
-which will automatically notice any modified (but not new) files, add
-them to the index, and commit, all in one step.
-
-A note on commit messages: Though not required, it's a good idea to
-begin the commit message with a single short (no more than 50
-characters) line summarizing the change, followed by a blank line and
-then a more thorough description. The text up to the first blank line in
-a commit message is treated as the commit title, and that title is used
-throughout Git.  For example, linkgit:git-format-patch[1] turns a
-commit into email, and it uses the title on the Subject line and the
-rest of the commit in the body.
-
-Git tracks content not files
-----------------------------
-
-Many revision control systems provide an `add` command that tells the
-system to start tracking changes to a new file.  Git's `add` command
-does something simpler and more powerful: `git add` is used both for new
-and newly modified files, and in both cases it takes a snapshot of the
-given files and stages that content in the index, ready for inclusion in
-the next commit.
-
-Viewing project history
------------------------
-
-At any point you can view the history of your changes using
-
-------------------------------------------------
-$ git log
-------------------------------------------------
-
-If you also want to see complete diffs at each step, use
-
-------------------------------------------------
-$ git log -p
-------------------------------------------------
-
-Often the overview of the change is useful to get a feel of
-each step
-
-------------------------------------------------
-$ git log --stat --summary
-------------------------------------------------
-
-Managing branches
------------------
-
-A single Git repository can maintain multiple branches of
-development.  To create a new branch named `experimental`, use
-
-------------------------------------------------
-$ git branch experimental
-------------------------------------------------
-
-If you now run
-
-------------------------------------------------
-$ git branch
-------------------------------------------------
-
-you'll get a list of all existing branches:
-
-------------------------------------------------
-  experimental
-* master
-------------------------------------------------
-
-The `experimental` branch is the one you just created, and the
-`master` branch is a default branch that was created for you
-automatically.  The asterisk marks the branch you are currently on;
-type
-
-------------------------------------------------
-$ git switch experimental
-------------------------------------------------
-
-to switch to the `experimental` branch.  Now edit a file, commit the
-change, and switch back to the `master` branch:
-
-------------------------------------------------
-(edit file)
-$ git commit -a
-$ git switch master
-------------------------------------------------
-
-Check that the change you made is no longer visible, since it was
-made on the `experimental` branch and you're back on the `master` branch.
-
-You can make a different change on the `master` branch:
-
-------------------------------------------------
-(edit file)
-$ git commit -a
-------------------------------------------------
-
-at this point the two branches have diverged, with different changes
-made in each.  To merge the changes made in `experimental` into `master`, run
-
-------------------------------------------------
-$ git merge experimental
-------------------------------------------------
-
-If the changes don't conflict, you're done.  If there are conflicts,
-markers will be left in the problematic files showing the conflict;
-
-------------------------------------------------
-$ git diff
-------------------------------------------------
-
-will show this.  Once you've edited the files to resolve the
-conflicts,
-
-------------------------------------------------
-$ git commit -a
-------------------------------------------------
-
-will commit the result of the merge. Finally,
-
-------------------------------------------------
-$ gitk
-------------------------------------------------
-
-will show a nice graphical representation of the resulting history.
-
-At this point you could delete the `experimental` branch with
-
-------------------------------------------------
-$ git branch -d experimental
-------------------------------------------------
-
-This command ensures that the changes in the `experimental` branch are
-already in the current branch.
-
-If you develop on a branch `crazy-idea`, then regret it, you can always
-delete the branch with
-
--------------------------------------
-$ git branch -D crazy-idea
--------------------------------------
-
-Branches are cheap and easy, so this is a good way to try something
-out.
-
-Using Git for collaboration
----------------------------
-
-Suppose that Alice has started a new project with a Git repository in
-`/home/alice/project`, and that Bob, who has a home directory on the
-same machine, wants to contribute.
-
-Bob begins with:
-
-------------------------------------------------
-bob$ git clone /home/alice/project myrepo
-------------------------------------------------
-
-This creates a new directory `myrepo` containing a clone of Alice's
-repository.  The clone is on an equal footing with the original
-project, possessing its own copy of the original project's history.
-
-Bob then makes some changes and commits them:
-
-------------------------------------------------
-(edit files)
-bob$ git commit -a
-(repeat as necessary)
-------------------------------------------------
-
-When he's ready, he tells Alice to pull changes from the repository
-at `/home/bob/myrepo`.  She does this with:
-
-------------------------------------------------
-alice$ cd /home/alice/project
-alice$ git pull /home/bob/myrepo master
-------------------------------------------------
-
-This merges the changes from Bob's `master` branch into Alice's
-current branch.  If Alice has made her own changes in the meantime,
-then she may need to manually fix any conflicts.
-
-The `pull` command thus performs two operations: it fetches changes
-from a remote branch, then merges them into the current branch.
-
-Note that in general, Alice would want her local changes committed before
-initiating this `pull`.  If Bob's work conflicts with what Alice did since
-their histories forked, Alice will use her working tree and the index to
-resolve conflicts, and existing local changes will interfere with the
-conflict resolution process (Git will still perform the fetch but will
-refuse to merge -- Alice will have to get rid of her local changes in
-some way and pull again when this happens).
-
-Alice can peek at what Bob did without merging first, using the `fetch`
-command; this allows Alice to inspect what Bob did, using a special
-symbol `FETCH_HEAD`, in order to determine if he has anything worth
-pulling, like this:
-
-------------------------------------------------
-alice$ git fetch /home/bob/myrepo master
-alice$ git log -p HEAD..FETCH_HEAD
-------------------------------------------------
-
-This operation is safe even if Alice has uncommitted local changes.
-The range notation `HEAD..FETCH_HEAD` means "show everything that is reachable
-from the `FETCH_HEAD` but exclude anything that is reachable from `HEAD`".
-Alice already knows everything that leads to her current state (`HEAD`),
-and reviews what Bob has in his state (`FETCH_HEAD`) that she has not
-seen with this command.
-
-If Alice wants to visualize what Bob did since their histories forked
-she can issue the following command:
-
-------------------------------------------------
-$ gitk HEAD..FETCH_HEAD
-------------------------------------------------
-
-This uses the same two-dot range notation we saw earlier with `git log`.
-
-Alice may want to view what both of them did since they forked.
-She can use three-dot form instead of the two-dot form:
-
-------------------------------------------------
-$ gitk HEAD...FETCH_HEAD
-------------------------------------------------
-
-This means "show everything that is reachable from either one, but
-exclude anything that is reachable from both of them".
-
-Please note that these range notations can be used with both `gitk`
-and `git log`.
-
-After inspecting what Bob did, if there is nothing urgent, Alice may
-decide to continue working without pulling from Bob.  If Bob's history
-does have something Alice would immediately need, Alice may choose to
-stash her work-in-progress first, do a `pull`, and then finally unstash
-her work-in-progress on top of the resulting history.
-
-When you are working in a small closely knit group, it is not
-unusual to interact with the same repository over and over
-again.  By defining 'remote' repository shorthand, you can make
-it easier:
-
-------------------------------------------------
-alice$ git remote add bob /home/bob/myrepo
-------------------------------------------------
-
-With this, Alice can perform the first part of the `pull` operation
-alone using the `git fetch` command without merging them with her own
-branch, using:
-
--------------------------------------
-alice$ git fetch bob
--------------------------------------
-
-Unlike the longhand form, when Alice fetches from Bob using a
-remote repository shorthand set up with `git remote`, what was
-fetched is stored in a remote-tracking branch, in this case
-`bob/master`.  So after this:
-
--------------------------------------
-alice$ git log -p master..bob/master
--------------------------------------
-
-shows a list of all the changes that Bob made since he branched from
-Alice's `master` branch.
-
-After examining those changes, Alice
-could merge the changes into her `master` branch:
-
--------------------------------------
-alice$ git merge bob/master
--------------------------------------
-
-This `merge` can also be done by 'pulling from her own remote-tracking
-branch', like this:
-
--------------------------------------
-alice$ git pull . remotes/bob/master
--------------------------------------
-
-Note that git pull always merges into the current branch,
-regardless of what else is given on the command line.
-
-Later, Bob can update his repo with Alice's latest changes using
-
--------------------------------------
-bob$ git pull
--------------------------------------
-
-Note that he doesn't need to give the path to Alice's repository;
-when Bob cloned Alice's repository, Git stored the location of her
-repository in the repository configuration, and that location is
-used for pulls:
-
--------------------------------------
-bob$ git config --get remote.origin.url
-/home/alice/project
--------------------------------------
-
-(The complete configuration created by `git clone` is visible using
-`git config list`, and the linkgit:git-config[1] man page
-explains the meaning of each option.)
-
-Git also keeps a pristine copy of Alice's `master` branch under the
-name `origin/master`:
-
--------------------------------------
-bob$ git branch -r
-  origin/master
--------------------------------------
-
-If Bob later decides to work from a different host, he can still
-perform clones and pulls using the ssh protocol:
-
--------------------------------------
-bob$ git clone alice.org:/home/alice/project myrepo
--------------------------------------
-
-Alternatively, Git has a native protocol, or can use http;
-see linkgit:git-pull[1] for details.
-
-Git can also be used in a CVS-like mode, with a central repository
-that various users push changes to; see linkgit:git-push[1] and
-linkgit:gitcvs-migration[7].
-
-Exploring history
------------------
-
-Git history is represented as a series of interrelated commits.  We
-have already seen that the `git log` command can list those commits.
-Note that first line of each `git log` entry also gives a name for the
-commit:
-
--------------------------------------
-$ git log
-commit c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
-Author: Junio C Hamano <junkio@cox.net>
-Date:   Tue May 16 17:18:22 2006 -0700
-
-    merge-base: Clarify the comments on post processing.
--------------------------------------
-
-We can give this name to `git show` to see the details about this
-commit.
-
--------------------------------------
-$ git show c82a22c39cbc32576f64f5c6b3f24b99ea8149c7
--------------------------------------
-
-But there are other ways to refer to commits.  You can use any initial
-part of the name that is long enough to uniquely identify the commit:
-
--------------------------------------
-$ git show c82a22c39c	# the first few characters of the name are
-			# usually enough
-$ git show HEAD		# the tip of the current branch
-$ git show experimental	# the tip of the "experimental" branch
--------------------------------------
-
-Every commit usually has one "parent" commit
-which points to the previous state of the project:
-
--------------------------------------
-$ git show HEAD^  # to see the parent of HEAD
-$ git show HEAD^^ # to see the grandparent of HEAD
-$ git show HEAD~4 # to see the great-great grandparent of HEAD
--------------------------------------
-
-Note that merge commits may have more than one parent:
-
--------------------------------------
-$ git show HEAD^1 # show the first parent of HEAD (same as HEAD^)
-$ git show HEAD^2 # show the second parent of HEAD
--------------------------------------
-
-You can also give commits names of your own; after running
-
--------------------------------------
-$ git tag v2.5 1b2e1d63ff
--------------------------------------
-
-you can refer to `1b2e1d63ff` by the name `v2.5`.  If you intend to
-share this name with other people (for example, to identify a release
-version), you should create a "tag" object, and perhaps sign it; see
-linkgit:git-tag[1] for details.
-
-Any Git command that needs to know a commit can take any of these
-names.  For example:
-
--------------------------------------
-$ git diff v2.5 HEAD	 # compare the current HEAD to v2.5
-$ git branch stable v2.5 # start a new branch named "stable" based
-			 # at v2.5
-$ git reset --hard HEAD^ # reset your current branch and working
-			 # directory to its state at HEAD^
--------------------------------------
-
-Be careful with that last command: in addition to losing any changes
-in the working directory, it will also remove all later commits from
-this branch.  If this branch is the only branch containing those
-commits, they will be lost.  Also, don't use `git reset` on a
-publicly-visible branch that other developers pull from, as it will
-force needless merges on other developers to clean up the history.
-If you need to undo changes that you have pushed, use `git revert`
-instead.
-
-The `git grep` command can search for strings in any version of your
-project, so
-
--------------------------------------
-$ git grep "hello" v2.5
--------------------------------------
-
-searches for all occurrences of "hello" in `v2.5`.
-
-If you leave out the commit name, `git grep` will search any of the
-files it manages in your current directory.  So
-
--------------------------------------
-$ git grep "hello"
--------------------------------------
-
-is a quick way to search just the files that are tracked by Git.
-
-Many Git commands also take sets of commits, which can be specified
-in a number of ways.  Here are some examples with `git log`:
-
--------------------------------------
-$ git log v2.5..v2.6            # commits between v2.5 and v2.6
-$ git log v2.5..                # commits since v2.5
-$ git log --since="2 weeks ago" # commits from the last 2 weeks
-$ git log v2.5.. Makefile       # commits since v2.5 which modify
-				# Makefile
--------------------------------------
-
-You can also give `git log` a "range" of commits where the first is not
-necessarily an ancestor of the second; for example, if the tips of
-the branches `stable` and `master` diverged from a common
-commit some time ago, then
-
--------------------------------------
-$ git log stable..master
--------------------------------------
-
-will list commits made in the `master` branch but not in the
-stable branch, while
-
--------------------------------------
-$ git log master..stable
--------------------------------------
-
-will show the list of commits made on the stable branch but not
-the `master` branch.
-
-The `git log` command has a weakness: it must present commits in a
-list.  When the history has lines of development that diverged and
-then merged back together, the order in which `git log` presents
-those commits is meaningless.
-
-Most projects with multiple contributors (such as the Linux kernel,
-or Git itself) have frequent merges, and `gitk` does a better job of
-visualizing their history.  For example,
-
--------------------------------------
-$ gitk --since="2 weeks ago" drivers/
--------------------------------------
-
-allows you to browse any commits from the last 2 weeks of commits
-that modified files under the `drivers` directory.  (Note: you can
-adjust gitk's fonts by holding down the control key while pressing
-"-" or "+".)
-
-Finally, most commands that take filenames will optionally allow you
-to precede any filename by a commit, to specify a particular version
-of the file:
-
--------------------------------------
-$ git diff v2.5:Makefile HEAD:Makefile.in
--------------------------------------
-
-You can also use `git show` to see any such file:
-
--------------------------------------
-$ git show v2.5:Makefile
--------------------------------------
-
-Next Steps
-----------
-
-This tutorial should be enough to perform basic distributed revision
-control for your projects.  However, to fully understand the depth
-and power of Git you need to understand two simple ideas on which it
-is based:
-
-  * The object database is the rather elegant system used to
-    store the history of your project--files, directories, and
-    commits.
-
-  * The index file is a cache of the state of a directory tree,
-    used to create commits, check out working directories, and
-    hold the various trees involved in a merge.
-
-Part two of this tutorial explains the object
-database, the index file, and a few other odds and ends that you'll
-need to make the most of Git. You can find it at linkgit:gittutorial-2[7].
-
-If you don't want to continue with that right away, a few other
-digressions that may be interesting at this point are:
-
-  * linkgit:git-format-patch[1], linkgit:git-am[1]: These convert
-    series of git commits into emailed patches, and vice versa,
-    useful for projects such as the Linux kernel which rely heavily
-    on emailed patches.
-
-  * linkgit:git-bisect[1]: When there is a regression in your
-    project, one way to track down the bug is by searching through
-    the history to find the exact commit that's to blame.  `git bisect`
-    can help you perform a binary search for that commit.  It is
-    smart enough to perform a close-to-optimal search even in the
-    case of complex non-linear history with lots of merged branches.
-
-  * linkgit:gitworkflows[7]: Gives an overview of recommended
-    workflows.
-
-  * linkgit:giteveryday[7]: Everyday Git with 20 Commands Or So.
-
-  * linkgit:gitcvs-migration[7]: Git for CVS users.
-
-SEE ALSO
---------
-linkgit:gittutorial-2[7],
-linkgit:gitcvs-migration[7],
-linkgit:gitcore-tutorial[7],
-linkgit:gitglossary[7],
-linkgit:git-help[1],
-linkgit:gitworkflows[7],
-linkgit:giteveryday[7],
-link:user-manual.html[The Git User's Manual]
-
-GIT
----
-Part of the linkgit:git[1] suite
-- 
gitgitgadget


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/2] doc: add new Git tutorial for beginners
  2026-10-19 14:55 ` [PATCH v2 0/2] " Julia Evans via GitGitGadget
  2026-10-19 14:55   ` [PATCH v2 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
@ 2026-10-19 14:55   ` Julia Evans via GitGitGadget
  2026-10-20  1:24   ` [PATCH v2 0/2] doc: add new git tutorial Junio C Hamano
  2 siblings, 0 replies; 15+ messages in thread
From: Julia Evans via GitGitGadget @ 2026-10-19 14:55 UTC (permalink / raw)
  To: git; +Cc: D. Ben Knoble, Julia Evans, Julia Evans

From: Julia Evans <julia@jvns.ca>

Introduce Git in two parts:

Steps 1-7: Create an empty repo & make 2 commits (`git init`,
`git add`, `git commit`, `git status`, `git diff`)
Steps 8-12: Push the repo to a remote host like GitHub or GitLab
(`git remote add`, `git push`)

Some design choices:

- Introduce a much smaller set of commands than the old tutorial, to
  keep the tutorial quick (doable in an hour). Some users found it to be
  very fast and some wanted to stop early (after step 7) so this seems
  to be a good balance.
- Have users start with an empty repository instead of an existing
  project, because many of the testers did not have an existing project
  to test, or were scared of using an existing project.
- Add a troubleshooting section, since in the testing some users got
  extremely stuck (for 4+ hours) on minor issues like needing to say
  "yes" when SSHing to a new host.
- Don't explain branches, because explaining branches and collaboration
  is complicated and deserves its own tutorial. Instead just tell users
  we're not going to explain them in this document.
- Tell users to set their default branch to `main`, because many Git
  hosts use it as their default branch and it really simplifies things.
- Keep it as vendor neutral as possible, while acknowledging the reality
  that Git hosting services like GitHub, GitLab, etc are extremely
  popular. Do this by creating the repo locally and then optionally
  pushing it later.
- Use SSH for authentication, explaining how to set up SSH in the
  easiest way possible (with disclaimers to check your security team's
  policy if applicable since the "easiest way" may not be the best), and
  giving some instructions for how to translate an HTTPS URL to an SSH
  URL.

At least 20 people have successfully completed it, and feedback was
incorporated from problems the testers ran into.

Co-authored-by: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
Signed-off-by: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/gittutorial.adoc | 739 +++++++++++++++++++++++++++++++++
 1 file changed, 739 insertions(+)
 create mode 100644 Documentation/gittutorial.adoc

diff --git a/Documentation/gittutorial.adoc b/Documentation/gittutorial.adoc
new file mode 100644
index 0000000000..c8b6f0ebd0
--- /dev/null
+++ b/Documentation/gittutorial.adoc
@@ -0,0 +1,739 @@
+gittutorial(7)
+==============
+
+NAME
+----
+gittutorial - Introduction to Git for beginners
+
+DESCRIPTION
+-----------
+
+Git is a program that lets you collaborate with others on code, back up
+your code, roll back to an earlier version of your project, track how
+your project has changed over time, and much more.
+
+This tutorial explains how to create a new Git project, make
+changes to it, and upload the project to the Internet. It usually takes
+less than an hour if you have a little previous experience with Git, and
+1-2 hours if not.
+
+We'll show you how to use the commands `git commit`, `git add`,
+`git diff`, `git status`, and `git push`.
+
+What we'll be doing
+-------------------
+
+Git lets you take snapshots of your code, like a checkpoint in a video
+game. These snapshots are called "commits". Which files to save in a
+commit is up to you.
+
+When Git stores a commit, it stores a copy of every file in the commit
+in a database in a directory called `.git`. This is called a "Git repository".
+
+In this tutorial we're going to show you how to:
+
+1. Create a Git repository in a directory with the command `git init`.
+   This creates the `.git` directory where Git stores all your commits.
+2. Tell Git which files you want to put in a commit
+3. Make a commit
+4. Change a file and make a new commit with the new version
+5. Make experimental changes and throw them away
+
+We'll also explain how to use Git to put your code on the Internet.
+
+Command line vs graphical interfaces
+------------------------------------
+
+Git is a command line program, but there are many graphical interfaces
+for Git built by the community. Your text editor might even have a
+built-in Git integration.
+
+In this tutorial, we'll give instructions for using Git from the
+command line. We can't give you instructions for how to do it in your
+graphical interface because there are so many of them.
+
+You can always switch back and forth between using the command line and
+a graphical interface at any time.
+
+Step 1: Make sure Git is installed
+----------------------------------
+
+To do this tutorial, you'll need:
+
+1. Git to be installed. You might already have it installed,
+   and if not there are directions at https://git-scm.com/install/
+2. A terminal to use. On Windows, you can use Git Bash which comes
+   when you install Git.
+
+You can check if Git is installed by running this in your terminal:
+
+------------------------------------------------
+$ git --version
+------------------------------------------------
+
+It should output something like this:
+
+------------------------------------------------
+git version 2.54.0
+------------------------------------------------
+
+The exact version isn't too important: this tutorial is designed to work
+with any version of Git after 2.0.
+
+[[step_2]]
+Step 2: Introduce yourself to Git
+---------------------------------
+
+The first time you use Git on a computer, it's a good idea to tell Git
+your name and public email address. If you don't, you'll get a lot of
+warnings from Git. To do this, run:
+
+------------------------------------------------
+$ git config --global user.name "Namey McName"
+$ git config --global user.email you@example.com
+------------------------------------------------
+
+The name and email is so that other people you're collaborating with
+can know who made the changes. You can set them to anything you want.
+
+To check if the name and email have been set, you can run these
+commands. They should display your name and email:
+
+------------------------------------------------
+$ git config user.name
+$ git config user.email
+------------------------------------------------
+
+Next, configure Git to set the default branch name to `main` (instead
+of `master`) by running this command. We can't explain what a branch is
+yet, but Git is going to
+https://sfconservancy.org/news/2020/jun/23/gitbranchname/[make `main` the default soon],
+and setting this avoids some extremely annoying problems in Step 14.
+
+------------------------------------------------
+$ git config --global init.defaultBranch main
+------------------------------------------------
+
+If there's no output, then it succeeded.
+
+[NOTE]
+It's also possible to set a different email address for every project,
+but we're not covering that here.
+
+Step 3: Create an empty folder and 1 file
+------------------------------------------
+
+In your terminal, create an empty folder and change directories into it.
+Later on you could follow the same steps in this tutorial to take an
+existing project and start managing it with Git, but we're going to use
+an empty project so that everyone following this tutorial has the exact
+same files.
+
+For example, run these commands to make a folder called `myproject`
+
+------------------------------------------------
+$ mkdir myproject
+$ cd myproject
+------------------------------------------------
+
+Next, using your text editor, create a file in this directory, so we
+have something to work with.
+
+Make a file called README.md, with these contents:
+
+------------------------------------------------
+We're doing a Git tutorial!
+We need 2 lines in this file so here's a second one
+------------------------------------------------
+
+Save `README.md` and keep it open in your text editor so you can
+easily edit it later. The exact contents aren't too important, but
+we'll use those contents in the example output later.
+
+You can check that the file is in the right place by running `ls`,
+like this:
+
+------------------------------------------------
+$ ls
+------------------------------------------------
+
+The output should look like this:
+
+------------------------------------------------
+README.md
+------------------------------------------------
+
+Step 4: Create a Git repository
+-------------------------------
+
+A Git repository lets you save snapshots of your code. Every time you make a
+snapshot, Git stores a copy of the contents of every file in the snapshot.
+
+This might feel unbelievable, but Git uses compression so you can easily
+store tens of thousands of snapshots without using too much disk space.
+
+You can create a Git repository for any folder in your computer by
+running the command `git init`.
+
+Run `git init` in the folder you just created, like this:
+
+------------------------------------------------
+$ git init
+------------------------------------------------
+
+Git will reply:
+
+------------------------------------------------
+Initialized empty Git repository in .git/
+------------------------------------------------
+
+You might notice a new hidden folder was created, named `.git`.
+You don't need to use this folder directly in any way, but it's where
+your commits will be stored.
+
+Step 5: Make your first commit
+------------------------------
+
+Next, we're going to take a snapshot of all the files in the directory
+and tell Git to store them. Git calls these snapshots "commits".
+Making a commit in Git is a two step process: first you need to run `git
+add` and then `git commit`.
+
+The reason it's a two step process is that sometimes you might not
+actually want Git to store a commit with _all_ the files in a folder.
+For example, if you're compiling your program to a binary, you might
+want Git to put the program's source code in your commit but not
+compiled binary. You can also use a `.gitignore` file to help with this.
+
+For now, we're going to store a commit with every file in your folder,
+as well as in every subfolder.
+
+The first step of making a commit is to tell Git which files you
+want to include in the commit using `git add`. To tell Git
+"include all files", run this command:
+
+------------------------------------------------
+$ git add .
+------------------------------------------------
+
+To check if it succeeded, you can run `git status`.
+The output should look like this:
+
+
+------------------------------------------------
+$ git status
+On branch main
+
+No commits yet
+
+Changes to be committed:
+  (use "git rm --cached <file>..." to unstage)
+        new file:   README.md
+------------------------------------------------
+
+Next you can create the commit using the `git commit` command, like
+this:
+
+------------------------------------------------
+$ git commit -m "Initial commit"
+------------------------------------------------
+
+The `-m` flag stands for "message", and it lets you set a reminder
+for your future self of what you were doing. The message
+("Initial commit" in this example) can say anything you want.
+
+The output should look like this:
+
+------------------------------------------------
+[main (root-commit) 4a7e367] Initial commit
+ 1 file changed, 2 insertions(+)
+ create mode 100644 README.md
+------------------------------------------------
+
+You've now stored the first version of your project in Git!
+
+Step 6: Make a change
+---------------------
+
+Now, let's learn how to make a change to a file and review the change you made.
+In this example, we'll update the file `README.md`, but you can edit a
+different file.
+
+First open `README.md` in your favourite text editor, make a tiny or
+silly change, and save it. In our example, we'll edit the first line to
+add more exclamation marks:
+
+------------------------------------------------
+We're doing a Git tutorial!!!!
+------------------------------------------------
+
+
+Next, in the terminal, run the command `git status` to get a summary of
+what you changed since the last Git commit.
+
+------------------------------------------------
+$ git status
+------------------------------------------------
+
+The output will look something like this:
+
+------------------------------------------------
+On branch main
+
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git restore <file>..." to discard changes in working directory)
+        modified:   README.md
+------------------------------------------------
+
+This output says that we've changed `README.md` since the last time
+we committed.
+
+Next, if you want to see the details of how you've changed `README.md`,
+you can run `git diff`.
+
+------------------------------------------------
+$ git diff
+------------------------------------------------
+
+The output will look something like this:
+
+------------------------------------------------
+diff --git a/README.md b/README.md
+index ffa8b85..a49e4b0 100644
+--- a/README.md
++++ b/README.md
+@@ -1,2 +1,2 @@
+-We're doing a Git tutorial!
++We're doing a Git tutorial!!!!
+ We need 2 lines in this file so here's a second one
+------------------------------------------------
+
+This output says that we deleted one line (`We're doing a Git
+tutorial!`) and added one line (`We're doing a Git tutorial!!!!`). By
+default Git will show the lines you removed in red, and the lines you
+added in green. Removed lines start with a minus `-` and added lines
+start with a plus `+`.
+
+Step 7a: Make a second commit
+-----------------------------
+
+Now that we've changed `README.md`, let's make another commit.
+We're going to follow the same steps as before when we made our first
+commit.
+
+First, tell Git that we want to include the new version of `README.md`
+in the next commit:
+
+------------------------------------------------
+$ git add README.md
+------------------------------------------------
+
+and then run `git commit`, like this:
+
+------------------------------------------------
+$ git commit -m "Update README"
+------------------------------------------------
+
+The output should look like this:
+
+------------------------------------------------
+[main 32e0171] Update README
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+------------------------------------------------
+
+This says that the new commit is the same as the previous commit,
+except that we changed 1 line of 1 file.
+
+Step 7b: Make a second commit (the short way)
+---------------------------------------------
+
+Instead of running the two commands in Step 7a above, you
+could also run this command as a shortcut. It will:
+
+1. Get a list of every file in the most recent commit
+2. Commit the current version of all of those files
+
+------------------------------------------------
+$ git commit -am "Update README"
+------------------------------------------------
+
+The `-a` stands for "all".
+
+Understanding `git status` output: "untracked files"
+----------------------------------------------------
+
+Now let's talk about a term you'll see in the `git status` output:
+"untracked files".
+
+First create a new file called `example.txt`. It can be empty.
+
+Then run the command `git status`. You should see this output:
+
+----------
+On branch main
+
+Untracked files:
+  (use "git add <file>..." to include in what will be committed)
+        example.txt
+
+nothing added to commit but untracked files present (use "git add" to track)
+----------
+
+This has a list of "untracked files". An untracked file is a file which
+was not part of the latest commit. By default Git will ignore these
+files.
+
+If you want to commit an untracked file, you can add it like this:
+
+----------
+$ git add example.txt
+----------
+
+Then you can run `git commit` to commit it.
+
+Step 8: Make a change and throw it away
+---------------------------------------
+
+One of the most useful things about Git is that it lets you safely
+experiment: you never need to be scared to change your code because you
+can always go back to the old version.
+
+Before starting to experiment, run `git status` to check the current
+state of your Git repository:
+
+------------------------------------------------
+$ git status
+On branch main
+
+nothing to commit, working tree clean
+------------------------------------------------
+
+This "working tree clean" message means that there haven't been any
+changes since your last commit.
+
+Now make a change to your code, and run `git status` again. Like last
+time, you should see a message like this:
+
+------------------------------------------------
+$ git status
+On branch main
+
+Changes not staged for commit:
+  (use "git add <file>..." to update what will be committed)
+  (use "git restore <file>..." to discard changes in working directory)
+        modified:   README.md
+------------------------------------------------
+
+This tells us that `README.md` has been changed since the last commit.
+But we don't actually want this change, so let's undo it! We can restore
+`README.md` back to how it was at the most recent commit using the `git
+restore` command.
+
+**WARNING**: `git restore` can't be reversed! Any time you run it it's
+important to be absolutely sure that you're okay with throwing away your
+changes since the last commit.
+
+------------------------------------------------
+$ git restore README.md
+------------------------------------------------
+
+Now open `README.md` again. You should see that your changes have been undone.
+
+You can stop here!
+------------------
+
+The commands we've learned so far (`git init`, `git add`, `git commit`,
+`git diff`, `git status`, and `git restore`) are enough to get a lot out
+of Git on their own.
+
+With these commands, you can keep copies of past versions of your code
+on your computer and safely experiment with big changes to your code.
+
+When using Git this way, all of your code just lives on your computer.
+But if you want to put your code on the Internet so that other people
+can use it or back it up, then you'll need to learn about one more
+command: `git push`.
+
+The rest of this tutorial is about how to upload your code to a Git
+repository on the Internet. The high level process is:
+
+1. Create an account on the Git host
+2. Configure Git so that it can login to the Git host to make changes
+3. Run `git push origin main` to upload your code
+
+Navigating the Git host's UI can be tricky, and it's hard for us to
+give you exact directions because the UIs change a lot.
+There's a rich tradition of people learning Git from their "Git friend"
+who already knows Git, and if you have one of those it might be useful
+to ask them if you get stuck. There are many ways to do things in Git,
+so they might suggest a slightly different way.
+There's also a troubleshooting guide at the end with the most common
+issues folks have run into while doing this tutorial.
+
+Step 9: Create an account on a Git host
+---------------------------------------
+
+To put your code on the Internet, you need it to be hosted somewhere.
+The easiest way to do this is to sign up with a Git host. There's a list
+of Git hosts (many of them offer free accounts) at
+https://git-scm.com/tools/hosting. GitHub and GitLab are two popular hosts.
+
+If you're comfortable running a server, there are other ways to host
+a Git repository on the internet, like connecting through SSH or open
+source Git forge software to your server.
+
+Step 10: Create an SSH key (if needed)
+-------------------------------------
+
+For Git to upload changes to another Git repository, it needs a way to
+login to that repository. One of the most popular ways to do this is
+with an SSH key.
+
+If you don't already have an SSH key, you'll need to create one. On Mac
+or Linux, you can check if you already have an SSH key by running:
+
+-------------------------------------------
+$ ls ~/.ssh/*.pub
+-------------------------------------------
+
+If you don't already have an SSH key, run:
+
+-------------------------------------------
+$ ssh-keygen
+-------------------------------------------
+
+`ssh-keygen` will ask you for some details.
+The easiest way to do this is to just press Enter at every prompt until
+it's done.
+
+NOTE: All of the advice about how to use SSH in this tutorial is aimed
+at getting it to work as quickly as possible. Setting up SSH in a secure
+way is very far outside the scope of this tutorial. If you have a
+security team in your organization, they might have very different
+opinions about the appropriate way to configure authentication with Git.
+
+Step 11: Tell the Git host your SSH public key
+----------------------------------------------
+
+First, find your SSH key like this (on Mac or Linux):
+
+-------------------------------------------
+$ ls ~/.ssh/*.pub
+-------------------------------------------
+
+That will output something like
+
+-------------------------------------------
+/home/alice/.ssh/id_ed25519.pub
+-------------------------------------------
+
+Copy the contents of that file to your clipboard. It's important that
+the filename ends in `.pub` ("pub" stands for "public").
+
+Then login to your account on the Git host you chose and paste the SSH
+key into the appropriate place. Depending on the Git host, it's likely
+under "SSH keys" in your settings. If it asks you what type of SSH key,
+look for something like "Authentication Key".
+
+Once you've done this, you're done! Git will automatically use your SSH
+key to try to connect.
+
+[[step_12]]
+Step 12: Create an empty Git repository on the Git host
+-------------------------------------------------------
+
+Go to the Git host's website and create a new Git repository. If there's
+an option to "create a README.md", "add a license", or something
+similar, make sure to say no to all of them.
+
+**WARNING**: If you create a public repository and push your repository
+to it, then your name and email address, as well as the contents of
+any files you committed and every previous version of those files, will
+be on the public internet. Some Git hosts have the option to create
+a private repository instead, to keep your information private.
+
+Step 13: Find the address of the repository
+-------------------------------------------
+
+Now, find the address of the repository on your Git host. It should look
+something like this:
+
+-------------------------------------------
+git@git.example.com:username/repo.git
+-------------------------------------------
+
+(where `example.com`, `username` and `repo` will be replaced with the
+actual values).
+
+If you can only find an address starting with `https://`, then
+you can often translate it to the SSH format by replacing `https://`
+with `git@` and replacing the `/` after the domain name with an `:`.
+Here's how:
+
+-------------------------------------------
+https://git.example.com/username/repo
+^^^^^^^^               ^
+replace with "git@"    replace with ":"
+-------------------------------------------
+
+[[step_14]]
+Step 14: push your changes
+--------------------------
+
+Finally, we're ready to send the information in your local Git repository
+to the one on the internet!
+
+First, tell Git about the other repository by running `git remote add`
+in your terminal
+(replace `git@example.com:username/repo.git` with the actual address):
+
+-------------------------------------------
+$ git remote add origin git@example.com:username/repo.git
+-------------------------------------------
+
+This tells Git to save the URL `git@example.com:username/repo.git` in
+your Git repository's configuration under the name `origin`, so that you
+can use it later. If you make a mistake while doing this, you can run
+`git remote remove origin` and try again.
+
+Then tell Git to send the information, with `git push`
+(if this doesn't work, read the "Troubleshooting `git push`" section for advice!):
+
+-------------------------------------------
+$ git push --set-upstream origin main
+-------------------------------------------
+
+Let's break down this `git push` command:
+
+* `origin` refers to the Git repository that we just added with
+  `git remote add` (`git@example.com:username/repo.git`).
+  You can use any name (not just `origin`), but using `origin` often
+  makes things easier because it's the default for `git push` and `git pull`.
+* `main` is the name of your current Git branch.
+  We haven't covered branches yet, but `main` is the default branch name.
+* `--set-upstream` tells Git to make this the default for `git push` for
+  the `main` branch. After you set the upstream, `git status` will
+  also tell you if you have commits that haven't been pushed.
+
+The output should look like this:
+
+-------------------------------------------
+Enumerating objects: 7, done.
+Counting objects: 100% (7/7), done.
+Delta compression using up to 8 threads
+Compressing objects: 100% (6/6), done.
+Writing objects: 100% (7/7), 662 bytes | 662.00 KiB/s, done.
+Total 7 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
+To example.com:username/repo
+ * [new branch]      main -> main
+branch 'main' set up to track 'origin/main'.
+-------------------------------------------
+
+Any time you want to set up a new repository, you can repeat steps
+12-14, with one exception: you only need to pass `--set-upstream` the first time
+you push. Afterwards you can just run the command:
+
+-------
+$ git push origin main
+-------
+
+Troubleshooting `git push`
+--------------------------
+
+There are 3 main errors you might run into when running `git push origin main`.
+Getting errors when running `git push` is actually a big part of using
+Git, so congratulations! If you get to this part of the tutorial, you
+get a little bonus experience in debugging.
+
+Here's a guide to why they're happening and how to fix them.
+
+**Problem 1: You pushed to `main`, but your branch actually isn't called `main`**
+
+Here's the error:
+
+-------
+$ git push origin main
+error: src refspec main does not match any
+-------
+
+This might happen if you didn't set `init.defaultBranch` to `main` in
+<<step_2,Step 2>>.
+
+If you want to check the name of your current branch, you can run `git
+status`. For example, in this output, the current branch is "master".
+
+-------------------------------------------
+$ git status
+On branch master
+
+...
+-------------------------------------------
+
+To push your branch, you have a few options:
+
+* rename your branch to `main`, by running `git branch -m main`
+  and then run `git push origin main`
+* run `git push origin master`
+  (where `master` is the name of your actual current branch)
+
+**Problem 2: SSH error**
+
+Here's the error:
+
+-----
+$ git push origin main
+The authenticity of host 'github.com (140.82.116.3)' can't be established.
+ED25519 key fingerprint is: SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU
+This key is not known by any other names.
+Are you sure you want to continue connecting (yes/no/[fingerprint])?
+-----
+
+Git uses SSH to connect during `git push`, and this message happens when
+SSH connects to a new site that you haven't connected to before.
+
+The easiest way to handle this is to type "yes" and press Enter.
+
+**Problem 3: the repository already has commits in it**
+
+Here's the error:
+
+---------------------
+$ git push origin main
+! [rejected]        main -> main (fetch first)
+error: failed to push some refs to 'example.com:username/repo.git'
+hint: Updates were rejected because the remote contains work that you do not
+hint: have locally.
+---------------------
+
+If you see an error like this, it means that when you created the
+repository on your Git host, it added a commit to try to help you out.
+That's the "work that you do not have locally" in the error message.
+
+You should be able to fix this by redoing <<step_12,Step 12>>.
+Then <<step_14,Step 14>> should work.
+
+MORE USEFUL GIT COMMANDS
+------------------------
+
+We're not going to cover collaboration at all in this tutorial, but here are a
+few more commands that might be useful when using Git on your own:
+
+* To download a Git repository to use on your computer you can run
+  `git clone https://example.com/some/repo` (linkgit:git-clone[1]).
+* To tell Git to "un-add" a file that you added by accident, run
+  `git rm --cached FILENAME` (linkgit:git-rm[1])
+* To get a list of past commits, run `git log` (linkgit:git-log[1])
+* Every commit has an ID that looks something like this:
+  `497588f53141b531a59ed888c7d2d9b8f8a6742d`.
+  If you see a commit with `git log` that you want more details about,
+  you can run `git show COMMIT_ID` to see what changes that made since
+  the previous commit (linkgit:git-show[1])
+
+SEE ALSO
+--------
+linkgit:git-help[1],
+
+GIT
+---
+Part of the linkgit:git[1] suite
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] doc: add new Git tutorial for beginners
  2026-10-19 14:24     ` Julia Evans
@ 2026-10-19 16:49       ` Ben Knoble
  2026-10-19 20:42         ` Julia Evans
  0 siblings, 1 reply; 15+ messages in thread
From: Ben Knoble @ 2026-10-19 16:49 UTC (permalink / raw)
  To: Julia Evans; +Cc: Julia Evans, git


> Le 19 oct. 2026 à 10:25, Julia Evans <julia@jvns.ca> a écrit :

Acknowledging the original was a long email to begin with,

>> On Wed, Oct 7, 2026, at 3:48 PM, D. Ben Knoble wrote:
>>> On Tue, Oct 6, 2026 at 3:37 PM Julia Evans via GitGitGadget
>>> <gitgitgadget@gmail.com> wrote:
>>> +[[step_2]]
>>> +Step 2: Introduce yourself to Git
>>> +---------------------------------
>>> +
>>> +The first time you use Git on a computer, it's a good idea to tell Git
>>> +your name and public email address. If you don't, you'll get a lot of
>>> +warnings from Git. To do this, run:
>>> +
>>> +------------------------------------------------
>>> +$ git config --global user.name "Namey McName"
>>> +$ git config --global user.email you@example.com
>>> +------------------------------------------------
>>> +
>>> +The name and email is so that other people you're collaborating with can
>>> +know who made the changes. You can set them to anything you want.
>>> +
>>> +To check if the name and email have been set, you can run these
>>> +commands:
>>> +
>>> +------------------------------------------------
>>> +$ git config user.name
>>> +$ git config user.email
>>> +------------------------------------------------
>> Ought we recommend the newer forms (git config set, git config get)?
>> Or is the idea to remain compatible with older versions, such as the
>> 2.32 I happen to have in /usr/bin on unsupported macOS 12.7.6 from
>> very old (?) XCode?

I think this got missed?

>>> +
>>> +Set your default branch name to `main`, by running this command.
>>> +Git is going to change its default branch name to `main` soon, so this
>>> +sets you up well for the future.
>>> +
>>> +------------------------------------------------
>>> +$ git config --global init.defaultBranch main
>>> +------------------------------------------------
>>> +
>>> +If there's no output, then it succeeded.
>>> +
>>> +Step 3: Create an empty folder and 2 files
>>> +------------------------------------------
>>> +
>>> +In your terminal, create an empty folder and change directories into it.
>>> +Later on you could follow the same steps in this tutorial to take an
>>> +existing project and start managing it with Git, but we're going to use
>>> +an empty project so that everyone following this tutorial has the exact
>>> +same files.
>>> +
>>> +For example, run these commands to make a folder called `myproject`
>>> +
>>> +------------------------------------------------
>>> +$ mkdir myproject
>>> +$ cd myproject
>>> +------------------------------------------------
>> I don't know, and I'll probably bias towards what you've already
>> written over asking for changes, but: does it make things any easier
>> to read and follow along with if we "git init myproject" instead?
>> Perhaps this version plants the seed that it's not too late to start
>> tracking any existing project, though, which is valuable :)
>> I wonder if you had some rationale for choosing this particular
>> sequence? Just curious, now.

And so was this.

Both are fairly minor in the grand scheme of things, so I’ll treat 
silence as « not interesting right now » and not be offended ;)

> Thanks for the review!

You’re quite welcome!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] doc: add new Git tutorial for beginners
  2026-10-19 16:49       ` Ben Knoble
@ 2026-10-19 20:42         ` Julia Evans
  2026-10-19 21:14           ` D. Ben Knoble
  0 siblings, 1 reply; 15+ messages in thread
From: Julia Evans @ 2026-10-19 20:42 UTC (permalink / raw)
  To: D. Ben Knoble; +Cc: Julia Evans, git



On Mon, Oct 19, 2026, at 12:49 PM, Ben Knoble wrote:
>> Le 19 oct. 2026 à 10:25, Julia Evans <julia@jvns.ca> a écrit :
>
> Acknowledging the original was a long email to begin with,
>
>>> On Wed, Oct 7, 2026, at 3:48 PM, D. Ben Knoble wrote:
>>>> On Tue, Oct 6, 2026 at 3:37 PM Julia Evans via GitGitGadget
>>>> <gitgitgadget@gmail.com> wrote:
>>>> +[[step_2]]
>>>> +Step 2: Introduce yourself to Git
>>>> +---------------------------------
>>>> +
>>>> +The first time you use Git on a computer, it's a good idea to tell Git
>>>> +your name and public email address. If you don't, you'll get a lot of
>>>> +warnings from Git. To do this, run:
>>>> +
>>>> +------------------------------------------------
>>>> +$ git config --global user.name "Namey McName"
>>>> +$ git config --global user.email you@example.com
>>>> +------------------------------------------------
>>>> +
>>>> +The name and email is so that other people you're collaborating with can
>>>> +know who made the changes. You can set them to anything you want.
>>>> +
>>>> +To check if the name and email have been set, you can run these
>>>> +commands:
>>>> +
>>>> +------------------------------------------------
>>>> +$ git config user.name
>>>> +$ git config user.email
>>>> +------------------------------------------------
>>> Ought we recommend the newer forms (git config set, git config get)?
>>> Or is the idea to remain compatible with older versions, such as the
>>> 2.32 I happen to have in /usr/bin on unsupported macOS 12.7.6 from
>>> very old (?) XCode?
>
> I think this got missed?

It did! Because of the plain text emails it's tough for me to scan the >> and >
to see the replies (">>" and ">" look similar to me) so I missed them, I don't
know if it's possible to set up my email system to make it easier.

I didn't know about `git config set`, I put it on my list to think about. I
claimed at some point in this tutorial that it works on "any version above
2.0", which is a claim I didn't actually check yet, but I do think it's valuable to
support old versions and be explicit about which Git versions you can use the
tutorial with.

>>>> +
>>>> +Set your default branch name to `main`, by running this command.
>>>> +Git is going to change its default branch name to `main` soon, so this
>>>> +sets you up well for the future.
>>>> +
>>>> +------------------------------------------------
>>>> +$ git config --global init.defaultBranch main
>>>> +------------------------------------------------
>>>> +
>>>> +If there's no output, then it succeeded.
>>>> +
>>>> +Step 3: Create an empty folder and 2 files
>>>> +------------------------------------------
>>>> +
>>>> +In your terminal, create an empty folder and change directories into it.
>>>> +Later on you could follow the same steps in this tutorial to take an
>>>> +existing project and start managing it with Git, but we're going to use
>>>> +an empty project so that everyone following this tutorial has the exact
>>>> +same files.
>>>> +
>>>> +For example, run these commands to make a folder called `myproject`
>>>> +
>>>> +------------------------------------------------
>>>> +$ mkdir myproject
>>>> +$ cd myproject
>>>> +------------------------------------------------
>>> I don't know, and I'll probably bias towards what you've already
>>> written over asking for changes, but: does it make things any easier
>>> to read and follow along with if we "git init myproject" instead?
>>> Perhaps this version plants the seed that it's not too late to start
>>> tracking any existing project, though, which is valuable :)
>>> I wonder if you had some rationale for choosing this particular
>>> sequence? Just curious, now.
>
> And so was this.

I didn't see this one either :)

I had no idea `git init myproject` existed! I do think it's nice to
make it more obvious how you could start tracking an existing project.

> Both are fairly minor in the grand scheme of things, so I’ll treat 
> silence as « not interesting right now » and not be offended ;)
>
>> Thanks for the review!
>
> You’re quite welcome!

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] doc: add new Git tutorial for beginners
  2026-10-19 20:42         ` Julia Evans
@ 2026-10-19 21:14           ` D. Ben Knoble
  0 siblings, 0 replies; 15+ messages in thread
From: D. Ben Knoble @ 2026-10-19 21:14 UTC (permalink / raw)
  To: Julia Evans; +Cc: Julia Evans, git

On Mon, Oct 19, 2026 at 4:43 PM Julia Evans <julia@jvns.ca> wrote:
>
> On Mon, Oct 19, 2026, at 12:49 PM, Ben Knoble wrote:
> >> Le 19 oct. 2026 à 10:25, Julia Evans <julia@jvns.ca> a écrit :
> >
> > Acknowledging the original was a long email to begin with,
> >
> >>> On Wed, Oct 7, 2026, at 3:48 PM, D. Ben Knoble wrote:
> >>>> On Tue, Oct 6, 2026 at 3:37 PM Julia Evans via GitGitGadget
> >>>> <gitgitgadget@gmail.com> wrote:
> >>>> +[[step_2]]
> >>>> +Step 2: Introduce yourself to Git
> >>>> +---------------------------------
> >>>> +
> >>>> +The first time you use Git on a computer, it's a good idea to tell Git
> >>>> +your name and public email address. If you don't, you'll get a lot of
> >>>> +warnings from Git. To do this, run:
> >>>> +
> >>>> +------------------------------------------------
> >>>> +$ git config --global user.name "Namey McName"
> >>>> +$ git config --global user.email you@example.com
> >>>> +------------------------------------------------
> >>>> +
> >>>> +The name and email is so that other people you're collaborating with can
> >>>> +know who made the changes. You can set them to anything you want.
> >>>> +
> >>>> +To check if the name and email have been set, you can run these
> >>>> +commands:
> >>>> +
> >>>> +------------------------------------------------
> >>>> +$ git config user.name
> >>>> +$ git config user.email
> >>>> +------------------------------------------------
> >>> Ought we recommend the newer forms (git config set, git config get)?
> >>> Or is the idea to remain compatible with older versions, such as the
> >>> 2.32 I happen to have in /usr/bin on unsupported macOS 12.7.6 from
> >>> very old (?) XCode?
> >
> > I think this got missed?
>
> It did! Because of the plain text emails it's tough for me to scan the >> and >
> to see the replies (">>" and ">" look similar to me) so I missed them, I don't
> know if it's possible to set up my email system to make it easier.

No worries! I wonder if your client can color different nesting levels
differently? My iPhone's Mail.app does this and it's really handy.

> I didn't know about `git config set`, I put it on my list to think about. I
> claimed at some point in this tutorial that it works on "any version above
> 2.0", which is a claim I didn't actually check yet, but I do think it's valuable to
> support old versions and be explicit about which Git versions you can use the
> tutorial with.

Sounds good. I prefer to teach folks the "set" version now, but we
both care about some kind of backwards compatibility here, so I'm
happy with whatever you decide.

> >>>> +
> >>>> +Set your default branch name to `main`, by running this command.
> >>>> +Git is going to change its default branch name to `main` soon, so this
> >>>> +sets you up well for the future.
> >>>> +
> >>>> +------------------------------------------------
> >>>> +$ git config --global init.defaultBranch main
> >>>> +------------------------------------------------
> >>>> +
> >>>> +If there's no output, then it succeeded.
> >>>> +
> >>>> +Step 3: Create an empty folder and 2 files
> >>>> +------------------------------------------
> >>>> +
> >>>> +In your terminal, create an empty folder and change directories into it.
> >>>> +Later on you could follow the same steps in this tutorial to take an
> >>>> +existing project and start managing it with Git, but we're going to use
> >>>> +an empty project so that everyone following this tutorial has the exact
> >>>> +same files.
> >>>> +
> >>>> +For example, run these commands to make a folder called `myproject`
> >>>> +
> >>>> +------------------------------------------------
> >>>> +$ mkdir myproject
> >>>> +$ cd myproject
> >>>> +------------------------------------------------
> >>> I don't know, and I'll probably bias towards what you've already
> >>> written over asking for changes, but: does it make things any easier
> >>> to read and follow along with if we "git init myproject" instead?
> >>> Perhaps this version plants the seed that it's not too late to start
> >>> tracking any existing project, though, which is valuable :)
> >>> I wonder if you had some rationale for choosing this particular
> >>> sequence? Just curious, now.
> >
> > And so was this.
>
> I didn't see this one either :)
>
> I had no idea `git init myproject` existed! I do think it's nice to
> make it more obvious how you could start tracking an existing project.

One of today's lucky 10,000, then! :P

I'm more than happy with the mkdir && cd version, even if my fingers
prefer to type less (git init <dir>), so as before I'm happy with
whatever you settle on.

-- 
D. Ben Knoble

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/2] doc: add new git tutorial
  2026-10-19 14:55 ` [PATCH v2 0/2] " Julia Evans via GitGitGadget
  2026-10-19 14:55   ` [PATCH v2 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
  2026-10-19 14:55   ` [PATCH v2 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
@ 2026-10-20  1:24   ` Junio C Hamano
  2026-10-20  2:24     ` Ben Knoble
  2 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2026-10-20  1:24 UTC (permalink / raw)
  To: Julia Evans via GitGitGadget; +Cc: git, D. Ben Knoble, Julia Evans

"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> So far we've gotten 112 comments from 30ish beta testers who have tried to
> learn Git for the first using this tutorial....

And we waited for 10 hours after seeing this cover letter in
anticipation, but the patches haven't appeared on the list archive.
Does GGG need to be given a gentle nudge somehow?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/2] doc: add new git tutorial
  2026-10-20  1:24   ` [PATCH v2 0/2] doc: add new git tutorial Junio C Hamano
@ 2026-10-20  2:24     ` Ben Knoble
  2026-10-20 12:18       ` Julia Evans
  0 siblings, 1 reply; 15+ messages in thread
From: Ben Knoble @ 2026-10-20  2:24 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Julia Evans via GitGitGadget, git, Julia Evans


> Le 19 oct. 2026 à 21:24, Junio C Hamano <gitster@pobox.com> a écrit :
> 
> "Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> So far we've gotten 112 comments from 30ish beta testers who have tried to
>> learn Git for the first using this tutorial....
> 
> And we waited for 10 hours after seeing this cover letter in
> anticipation, but the patches haven't appeared on the list archive.
> Does GGG need to be given a gentle nudge somehow?

I received the v2 patches. I rather suspect the list did something interesting (or the archive), or that the messages were too big. 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/2] doc: add new git tutorial
  2026-10-20  2:24     ` Ben Knoble
@ 2026-10-20 12:18       ` Julia Evans
  0 siblings, 0 replies; 15+ messages in thread
From: Julia Evans @ 2026-10-20 12:18 UTC (permalink / raw)
  To: Ben Knoble; +Cc: Junio C Hamano, Julia Evans via GitGitGadget, git



> On Oct 19, 2026, at 10:24 PM, Ben Knoble <ben.knoble@gmail.com> wrote:
> 
> 
>> Le 19 oct. 2026 à 21:24, Junio C Hamano <gitster@pobox.com> a écrit :
>> 
>> "Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
>> 
>>> So far we've gotten 112 comments from 30ish beta testers who have tried to
>>> learn Git for the first using this tutorial....
>> 
>> And we waited for 10 hours after seeing this cover letter in
>> anticipation, but the patches haven't appeared on the list archive.
>> Does GGG need to be given a gentle nudge somehow?
> 
> I received the v2 patches. I rather suspect the list did something interesting (or the archive), or that the messages were too big.


I see the patches here in the list archive
https://lore.kernel.org/git/6532e60e30864c9bccfe5be0731c6913aa44d188.1792421748.git.gitgitgadget@gmail.com/ 

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-10-20 12:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-06 19:37 [PATCH 0/2] WIP: doc: add new git tutorial Julia Evans via GitGitGadget
2026-10-06 19:37 ` [PATCH 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
2026-10-06 19:37 ` [PATCH 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
2026-10-07 19:48   ` D. Ben Knoble
2026-10-19 14:24     ` Julia Evans
2026-10-19 16:49       ` Ben Knoble
2026-10-19 20:42         ` Julia Evans
2026-10-19 21:14           ` D. Ben Knoble
2026-10-07 19:26 ` [PATCH 0/2] WIP: doc: add new git tutorial D. Ben Knoble
2026-10-19 14:55 ` [PATCH v2 0/2] " Julia Evans via GitGitGadget
2026-10-19 14:55   ` [PATCH v2 1/2] doc: remove gittutorial Julia Evans via GitGitGadget
2026-10-19 14:55   ` [PATCH v2 2/2] doc: add new Git tutorial for beginners Julia Evans via GitGitGadget
2026-10-20  1:24   ` [PATCH v2 0/2] doc: add new git tutorial Junio C Hamano
2026-10-20  2:24     ` Ben Knoble
2026-10-20 12:18       ` Julia Evans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox