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 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]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 Layer | Minimum | Production recommendation | Purpose in stack |
|---|---|---|---|
| VS Code | Installed desktop editor | Current Stable build | Edit README.md after Desktop opens the repo |
| GitHub Desktop | Fresh install signed into github.com | Latest Desktop for your OS | Create, publish, branch, commit, PR entry points |
| GitHub account | Account Desktop can authorize | Same account you use on github.com | Name/email copied into Git on Finish; remote publish |
| Optional CLI tools | Git (Windows installer if needed), GitHub CLI, Copilot CLI | Only if you take the deeper section | gh 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.
-
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 blankREADME.md. Click Create repository. Including a README is standard practice so others can understand, set up, and run the project. -
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.
-
Create a branch for edits. Repositories start with a
mainbranch (the stable primary version). Select the Current Branch dropdown → New Branch. Name itreadme-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. -
Edit the README in VS Code and commit. In Desktop, click Open in Visual Studio Code. Paste this into
README.mdand save: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. -
Publish the branch, open a pull request, and merge. Click Publish branch to push
readme-updatesto the remote. Click Preview Pull Request, then Create Pull Request. In the GitHub window, set the title toAdd 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. -
Return to
mainand sync. In Desktop, if you are not onmain, open Current Branch and click main. Always switch back tomainbefore creating the next branch, because new branches copy whatever is currently selected. Click Fetch origin, then Pull origin, so localmainpicks up the merged README. -
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:
gh auth loginChoose GitHub.com and follow the prompts. Install GitHub Copilot CLI per Installing GitHub Copilot CLI. Ask Copilot what
git blamedoes:gh copilot explain "git blame"Then try it on the README:
git blame README.mdFor a single line, ask Copilot to build the command:
gh copilot suggest "Show me the blame for line 1 of README.md"Choose git command, then execute the suggestion:
git blame -L 1,1 README.mdThat 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.
| Check | Expected signal | If it fails |
|---|---|---|
| Local repo | Desktop shows learning-git with a README | Re-run Create a New Repository with the README checkbox |
| Remote | View on GitHub opens your published repo | Click Publish repository twice as documented |
| Branch | Current branch is readme-updates before the edit commit | Create Branch from the Current Branch menu |
| Commit | History shows Update README on readme-updates | Confirm VS Code saved, then Commit to readme-updates |
| Pull request | Merged PR titled "Add a message to the README" on main | Publish branch → Preview/Create Pull Request → Merge |
| Sync | After Fetch/Pull, local main has the README text | Switch 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 tomain. Fix: Current Branch →main, Fetch, Pull, then create the next branch. - Commit message empty or wrong branch: Cause: typing nowhere, or still on
mainwhen you meant the feature branch. Fix: selectreadme-updates, enterUpdate 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 copilotwithoutgh auth loginor Copilot CLI. Fix: authenticate withgh 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.