Need to work on two branches simultaneously without stashing or cloning? git worktree creates a separate working directory that shares the same .git — no duplicate objects, no wasted space.
git worktree add <path> <branch>
For example, to checkout feature/login into a sibling directory:
git worktree add ../my-feature feature/login
This creates ../my-feature with the branch checked out and ready to work. Commits, branches, and remotes are shared — it's one repository, multiple workspaces.
Day-to-day operations:
git worktree list — see all linked worktrees
git worktree remove <path> — clean up when done
One restriction: the same branch cannot be checked out in two worktrees at once. Git enforces this to prevent conflicting writes to the ref.
Some public networks (libraries, hotels, offices) block SSH's default port 22, which breaks git push/pull to GitHub.
GitHub supports SSH over port 443 as a workaround. Test it first:
ssh -T -p 443 [email protected]
If you see Hi <username>!, it works. Update your repo's remote URL:
git remote set-url origin ssh://[email protected]:443/your-username/your-repo.git
Then git push as normal.
Want this permanently? Add to ~/.ssh/config:
Host github.com
Hostname ssh.github.com
Port 443
This transparently redirects all GitHub SSH traffic to port 443 — no need to change remote URLs in any of your repos.
You probably know:
git diff shows unstaged changes.
git diff --cached shows staged changes.
But how do you see all changes in one go? Just use:
git diff HEAD
Here's the breakdown:
git diff compares the working directory to the staged index. If nothing is staged, it's the same as git diff HEAD.
git diff --cached compares the staged index to HEAD. It's a shortcut for git diff --cached HEAD.
git diff HEAD (or git diff <commit/branch/tag>) compares your current working directory with the specified commit.
Default 'Hide whitespace' can significantly save your time on reviewing. Many many developers have asked for this feature for a long time, but GitHub still doesn't officially support it. You don't have to wait.
This small browser extension GitHub Whitespace comes to rescure!
Deploying a Flutter web application to GitHub Pages is a straightforward process, but integrating a custom domain can sometimes introduce challenges. Recently, I faced an issue where my Flutter web app, which deployed perfectly to the default GitHub Pages URL, stopped working after setting up a custom subdomain. Here's a step-by-step guide on how I resolved this issue, which might help others facing the same problem.
The Initial Setup
I had a Flutter web app named "HappyNotes" hosted on GitHub Pages. The GitHub Actions workflow used to build and deploy the app looked like this:
name: Deploy HappyNotes Web
on:
workflow_dispatch:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.x'
channel: 'stable'
- name: Build web
run: |
cp .env.production .env
flutter config --enable-web
flutter build web --release --base-href "/HappyNotes/"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.RELEASE_TOKEN }}
publish_dir: ./build/web
This workflow worked flawlessly with the default URL: https://shukebeta.github.io/HappyNotes.
The Problem
After setting up a custom subdomain happynotes.shukebeta.com, the app stopped working. The root cause of this issue involved multiple configuration steps that needed to be adjusted for the custom domain to work properly.
The Solution
Here’s how I resolved the issue:
1. DNS Settings
First, I ensured that the DNS settings were correctly configured:
-
DNS Provider Configuration:
- Added a CNAME record for
happynotes.shukebeta.com pointing to shukebeta.github.io. (attention: the last . after io is important!)
2. GitHub Pages Configuration
Next, I checked the GitHub Pages settings:
-
Custom Domain Setup:
- Navigated to the repository’s settings on GitHub.
- Under the "Pages" section, set the custom domain to
happynotes.shukebeta.com.
- Enabled "Enforce HTTPS".
3. CNAME File
To ensure GitHub Pages recognized the custom domain, a CNAME file will be needed to put into the build/web directory. I automated this step in the GitHub Actions workflow:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.x'
channel: 'stable'
- name: Build web
run: |
cp .env.production .env
flutter config --enable-web
flutter build web --release --base-href "/"
- name: Create CNAME file
run: echo 'happynotes.shukebeta.com' > ./build/web/CNAME
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.RELEASE_TOKEN }}
publish_dir: ./build/web
4. Base URL Adjustment
Since the custom subdomain serves the app from the root, the base-href parameter is also needed to adjust:
- name: Build web
run: |
cp .env.production .env
flutter config --enable-web
flutter build web --release --base-href "/"
that's it.