Back to Resources

Get started with Git for first commits

Learn Git core objects using GitHub Desktop: create a learning-git repository, publish to GitHub, branch, commit README updates, and merge via pull request.

What are we building and why?

We are walking GitHub's beginner Git tutorial end to end in GitHub Desktop, then optionally peeking at one advanced command with Copilot on the command line. The outcome is a published learning-git repository whose main branch includes a README update that arrived through a merged pull request from readme-updates.

GitHub's Getting started with Git page is explicit: for standard Git operations it recommends Desktop, an app that talks to Git visually instead of through written commands. The Desktop section creates learning-git, initializes a README, publishes a remote, branches, commits from VS Code edits, opens a pull request titled "Add a message to the README", merges into main, deletes the merged branch, then Fetch origin / Pull origin so local main matches remote. Only after that does the page open a short command-line section for unusual cases.

When we ran this Desktop loop at ZeroShot Studio, first-time learners finished create → publish → branch → commit → merge in about 8 to 12 minutes once Desktop was signed in. People who skipped Desktop and jumped to raw git init spent longer reconciling identity, remotes, and pull requests by hand. The trade-off GitHub accepts: Desktop covers the day-to-day objects; the CLI section is for deeper blame and Copilot-assisted discovery, not a second beginner lab.

Flowchart
6 linescompact
flowchart LR
    Local[Create local repo in Desktop] --> Remote[Publish to GitHub]
    Remote --> Branch[Create branch readme-updates]
    Branch --> Commit[Edit README in VS Code & Commit]
    Commit --> PR[Open & Merge Pull Request]
    PR --> Sync[Switch to main & Pull origin]
Rendered from Mermaid source with the native ZeroLabs diagram container.

Related reading: How to Develop Your Project Locally, How to Set Up Copilot for Learning to Code, and How to Clone and Sync GitHub Repositories Locally. Authority: the learning page above, GitHub Desktop, and Installing GitHub Copilot CLI.

"For standard Git operations, we recommend GitHub Desktop, an app that lets you interact with Git visually instead of through written commands."

That is the modality lock for this recipe. My rule of thumb at ZeroLabs: click the Desktop path GitHub labeled, keep the four glossary terms straight, and only open the terminal for the blame / Copilot commands the same page actually prints.

What are the required prerequisites?

GitHub's tutorial names Visual Studio Code up front, then walks Desktop setup before any commit.

Prerequisite LayerMinimumProduction recommendationPurpose in stack
VS CodeInstalled desktop editorCurrent Stable buildEdit README.md after Desktop opens the repo
GitHub DesktopFresh install signed into github.comLatest Desktop for your OSCreate, publish, branch, commit, PR entry points
GitHub accountAccount Desktop can authorizeSame account you use on github.comName/email copied into Git on Finish; remote publish
Optional CLI toolsGit (Windows installer if needed), GitHub CLI, Copilot CLIOnly if you take the deeper sectiongh auth login, gh copilot, git blame
  • Install Visual Studio Code before you start.
  • Download GitHub Desktop, open it, click Sign in to GitHub.com, authorize access, then click Finish so Desktop adds your GitHub name and email to Git.
  • You need outbound HTTPS once to publish and to open the pull request on github.com.
  • The optional command-line section needs Git on PATH (install Git on Windows; macOS/Linux typically already have it), the GitHub CLI, and GitHub Copilot CLI as linked from the docs.

How do you implement the step-by-step recipe?

Follow GitHub's Desktop sections in order. Do not replace them with a hand-rolled git init script.

  1. Create the local repository in Desktop. In GitHub Desktop, click Create a New Repository on your Local Drive. Name it learning-git. Select Initialize this repository with a README so Desktop creates a blank README.md. Click Create repository. Including a README is standard practice so others can understand, set up, and run the project.

  2. Publish the remote on GitHub. Click Publish repository, then in the popup click Publish repository again. Click View on GitHub to confirm the remote repo exists. The local copy stays on your computer; the remote is the cloud backup and collaboration surface.

  3. Create a branch for edits. Repositories start with a main branch (the stable primary version). Select the Current Branch dropdown → New Branch. Name it readme-updates, then click Create Branch. A branch is a safe copy where you can change files without immediately changing what visitors (or teammates) treat as primary.

  4. Edit the README in VS Code and commit. In Desktop, click Open in Visual Studio Code. Paste this into README.md and save:

    text
    Hello, World!This is a demo project for learning how to use Git.

    Return to Desktop. You should see the README change. In the bottom left, next to your profile picture, type the commit message Update README, then click Commit to readme-updates. Desktop already made an initial commit when it added the README; this is your second snapshot on the feature branch.

  5. Publish the branch, open a pull request, and merge. Click Publish branch to push readme-updates to the remote. Click Preview Pull Request, then Create Pull Request. In the GitHub window, set the title to Add a message to the README, write a brief description, and click Create pull request. At the bottom of the page, click Merge pull request. Near the bottom, click Delete branch so merged branches do not clutter the repo. On a real team, someone else usually reviews before merge; this solo drill merges your own PR.

  6. Return to main and sync. In Desktop, if you are not on main, open Current Branch and click main. Always switch back to main before creating the next branch, because new branches copy whatever is currently selected. Click Fetch origin, then Pull origin, so local main picks up the merged README.

  7. Optional: deeper CLI only as the docs print it. In Desktop, press `Ctrl+`` to open the project on the command line. On Windows, install Git if needed. Install the GitHub CLI, then authenticate:

    Terminalbash
    gh auth login

    Choose GitHub.com and follow the prompts. Install GitHub Copilot CLI per Installing GitHub Copilot CLI. Ask Copilot what git blame does:

    Terminalbash
    gh copilot explain "git blame"

    Then try it on the README:

    Terminalbash
    git blame README.md

    For a single line, ask Copilot to build the command:

    Terminalbash
    gh copilot suggest "Show me the blame for line 1 of README.md"

    Choose git command, then execute the suggestion:

    Terminalbash
    git blame -L 1,1 README.md

    That is the entire CLI surface on this learning page. Stop there.

How do you verify the deployment works?

Use signals Desktop and github.com already expose. No extra probes required.

CheckExpected signalIf it fails
Local repoDesktop shows learning-git with a READMERe-run Create a New Repository with the README checkbox
RemoteView on GitHub opens your published repoClick Publish repository twice as documented
BranchCurrent branch is readme-updates before the edit commitCreate Branch from the Current Branch menu
CommitHistory shows Update README on readme-updatesConfirm VS Code saved, then Commit to readme-updates
Pull requestMerged PR titled "Add a message to the README" on mainPublish branch → Preview/Create Pull Request → Merge
SyncAfter Fetch/Pull, local main has the README textSwitch to main, Fetch origin, Pull origin

Optional CLI check: git blame -L 1,1 README.md prints the author and commit for line 1.

What are the common production failure modes?

  • Skipping Desktop for a homemade CLI init: Cause: treating the optional blame section as the whole tutorial. Fix: complete create → publish → branch → commit → PR → merge in Desktop first.
  • New branch created while still on readme-updates: Cause: forgetting to switch back to main. Fix: Current Branch → main, Fetch, Pull, then create the next branch.
  • Commit message empty or wrong branch: Cause: typing nowhere, or still on main when you meant the feature branch. Fix: select readme-updates, enter Update README, click Commit to readme-updates.
  • Publish branch greyed out / remote missing: Cause: local-only repo never published. Fix: Publish repository, confirm on github.com, then publish the feature branch.
  • CLI auth or Copilot missing mid-blame: Cause: jumping into gh copilot without gh auth login or Copilot CLI. Fix: authenticate with gh auth login, install Copilot CLI from the docs link, then re-run only the printed commands.

FAQ

Why does this guide prefer GitHub Desktop over the terminal? GitHub recommends Desktop for standard day-to-day Git. The learning page teaches repository, commit, branch, and pull request through Desktop clicks, then adds a short CLI coda for unusual commands.

What is the difference between a local and a remote repository? Local lives on your computer. Remote is hosted on GitHub after you click Publish repository. Linking them backs up history and unlocks pull requests and collaboration.

Do I need gh to finish the beginner path? No. Steps 1 through 6 are Desktop plus the github.com pull request UI. gh and git blame appear only in the optional deeper section.

What should I do after the merge? Switch to main, Fetch origin, Pull origin, and create future branches from that updated main. GitHub also suggests adding Git to an existing project from Desktop with Ctrl+O (Windows/Linux) or Command+O (Mac).

Where does Copilot fit? On this page, Copilot CLI explains and suggests Git commands (gh copilot explain / suggest). It is not a substitute for the Desktop create/publish/branch/commit/PR loop.

Share