When working on a personal project, treating the repository as though you are in a collaborative team environment is good practice. By separating work into feature branches and using pull requests to merge changes into the main branch, you create a clear documentation trail of your project's evolution and build up the skills required for team version control.
This blog outlines how I usually structure a solo GitHub workflow, detailing what to do via the graphical user interface (GUI) versus the command line interface (CLI), and providing a reference for when to run which commands.
GUI vs CLI: Where can you do what
It can be helpful to know when to use GitHub (the remote website) versus Git (the local command-line tool).
- GUI (github.com): Used for creating the initial remote repository and managing Pull Requests (PRs). Reviewing code and executing the merges to the main branch happens here.
- CLI (VS Code PowerShell Terminal): Used for local version control: branching, staging, committing, pushing, and pulling.
Initial Setup & Configuration
Before starting any project, you have to configure your local environment so that your version history is correctly attributed to you. You only need to run these globally once per machine.
git config --global user.name "[Firstname Lastname]": Sets an identifiable name for credit when reviewing version history.git config --global user.email "[valid-email]": Sets the email address associated with each history marker.
To then start a project, I usually create the repository on github.com, clone it to my machine by selecting 'Open in GitHub Desktop', clicking 'Open in VS Code', and opening a PowerShell terminal within VS Code.


Alternatively, the standard CLI method is to copy the repository URL, open your terminal, and run: git clone [url] (This retrieves the entire repository from the hosted location).
If you started a directory locally first without cloning, you would instead use git init to initialise the existing directory as a Git repository, followed by git remote add origin [url] to link it to GitHub.
The Git Branch Diagram

Commands for the Diagram:
- Setup Repo -> (A) Initialise/Clone: Setting up the repository on your local machine.
- Via GUI: Go to your newly created repository on GitHub > Code dropdown > Local tab > Open with GitHub Desktop. Click Clone, and then select 'Open in Visual Studio Code' once it has finished cloning.
- Via CLI (Cloning):
git clone [url] - Via CLI (Existing Local Folder): If you already have a project folder ready locally, use
git initto initialise the existing directory as a Git repository, followed bygit remote add origin [url]to link it to your GitHub repository.
- (B) Create a new branch: Create and move into a new branch for your new chunk/feature of the project.
git switch -c new-feature-branch
- (C) Stage & Commit: Run these commands once you have finished a logical piece of work or reached a working state in the branch that you might want to return to later.
git add .(Stages all tracked, modified, and deleted files).git commit -m "Message describing the work"
- (D) Stage & Commit (Again), and repeat this as many times on the branch as necessary: You have finished the next logical piece of work on this branch.
git add .git commit -m "Another descriptive message"
- (E) Transmit to Remote: Once the feature/chunk of work that the branch represents is done, tested and works, send your local branch commits to the remote GitHub repository so it can be reviewed (by yourself for a solo project).
git push origin new-feature-branch
- The Pull Request: Go to github.com. Click "Compare & pull request". Review the code, and merge it into main.
- (F) Return to Main: Back in VS Code, switch your local environment back to the primary timeline.
git switch main
- (G) Synchronise Main: Pull the new remote changes down to your local machine so your local main branch reflects the merge you just did on the website. This closes the loop so you are ready to repeat the process.
git pull(This fetches and merges any remote commits into your local branch).git status(Optional but good practice: checks your branch is up to date and clean before you start the next feature. From here, restart the loop from step B).
Additional commands for the day-to-day workflow
While the flow above can handle a lot of your daily work, you may need additional commands to see what you are doing as you work.
Checking Your Status:
As you work between points (B) and (E), you can check what files have changed.
git status: Shows the state of your working directory (what is tracked, untracked, or staged).git diff: Shows the lines of code you have changed but not yet staged.git diff --staged: Shows the lines of code you have staged (viagit add) but not yet committed.git log: Shows all commits in the current branch’s history. Useful if you forget where you left off the previous day.
Fixing Mistakes
If you accidentally stage a file you did not mean to track (for example, a large data file or a local config), you can remove it from the staging area before committing:
git reset [file]: Unstages a file whilst retaining the changes safely in your working directory.
Understanding Fetch vs Pull
When you run git pull at step (G), it is performing two commands simultaneously: git fetch and git merge.
git fetch origin: Downloads all the history and branches from the remote repository but does not alter your current working files.git merge origin/main: Merges that downloaded remote history into your current branch to bring it up to date.
Using git pull is the standard shortcut to execute both actions seamlessly when updating your main branch.
