Quick answer: The Android Studio Agent missed your commits because its git log command filtered by a date that carried the current time of day, printed only subject lines, and checked only the current branch. Start a new chat and tell the agent to run git log with --all, --since set to today at 00:00:00, and %B in the format. The exact prompt to copy is below.
I have been using the Android Studio Agent to get things done faster as I focus on what’s more important to me as I work on the Senior/PWD Discount Calculator app for Android.
A problem I encountered today was that my android studio agent tells me i dont have git commits today when i made over 10 commits. My goal was to get a git log of all commits done today, with complete commit messages.
How do I make Android Studio Agent list all of today’s git commits?
What made it work was sending this exact message to a new chat with the Android Studio Agent:
Run git log --all --since="2026-11-29 00:00:00" --pretty=format:"---%n%h (%ad)%n%B" --date=local and list all complete commit messages from today without summarizing or truncating them.
Change 2026-11-29 to today’s date before you send it. This prompt worked with both the Built-in Default and Gemini 3.1 Flash Lite agent models in Android Studio.
Hit the “Allow” button if Agent asks permission to run the git command:
How do I know it worked?
Check the shell tool output (stdout) in the agent’s reply. It should show every commit made after 00:00:00 today, separated by ---. Each one shows the short hash, the local timestamp, the subject line, and the full body text.
The agent’s output after running the prompt: every commit from today, with complete messages.
Why did Android Studio Agent say I had no git commits today?
Your repo was valid (the command finished with exitCode: "0"), so Git ran cleanly. It simply filtered your commits out, for three reasons.
Git adds the current time to a date-only –since
This was the main culprit. When you write --since="2026-11-29" with no time, Git fills in the current time of day, for example 2026-11-29 20:26:00. Every commit you made earlier than that minute is excluded, which hides most of today’s work. Writing 00:00:00 explicitly fixes it. See the official git log documentation for the date options.
The agent printed subject lines, not full commit messages
With --pretty=format:"%s", Git prints only the first line of each commit and strips the body. Even if the agent had found your commits, you would not get the complete messages. Use %B instead, which prints the full multi-line message. The Git pretty-formats documentation lists every placeholder.
git log without –all only checks your current branch
Without --all, git log only looks at your current HEAD branch. If any of your 10+ commits are on another local branch, they are skipped unless --all is included.
What if some commits are still missing?
They may have been committed in a different subfolder or repo root, or amended with an older committer date. To inspect your last 15 commits and their exact timestamps, replace --since="2026-11-29 00:00:00" with -n 15:
Outro: I have been thinking of creating a web version of the Senior/PWD Discount Calculator app so that it might help more users that don’t use any Android device. Might as well familiarize with ReactJS along the way!
Recently, I’ve been blessed with time to play around with things I missed in the world of web development while I’ve been heads-down in Android apps. Astro is one of the things I got curious about recently, and my curious mind led me to try making it display a page derived from the contents of a Markdown file containing my resume. Why a resume.md file? Simply because it’s what I happened to have, ready to use at that moment.
So, how do we serve an Astro Site from Subpath like /resume?
Quick answer for TL;DR peeps :-p
Tested: November 8, 2026 on macOS with Node.js v26.13.0 and Astro v7.4.7:
To build a resume website with Astro, install Node.js, create a project with npm create astro@latest resume-site (minimal template), save your Markdown resume as src/data/resume.md, set base: '/resume' in astro.config.mjs, render the resume in src/pages/index.astro, preview it with npm run dev, and generate the static files with npm run build. The result is a single-page static site served from the /resume path (locally at http://localhost:4321/resume/) that displays your Markdown resume.
To dive into more details beyond the above summary, such as screenshots from my terminal, copy-pasted code from files I edited, a troubleshooting “cheatsheet” table, and an FAQ.
Everything below was run on a Mac, and the exact versions are listed in the “Tested with” table for our reference. Yes, “our reference” — I write these how-to articles mainly for myself because I tend to easily forget things. (That girl could never remember if a friend resides in Pampanga or in Pangasinan? I’d rather not name that girl, but let’s call her Catzie.)
Okay, back to serious business!
Every command relevant to this article, in one place:
node -v
cd Documents
mkdir webproj
cd webproj
npm create astro@latest resume-site
cd resume-site
mkdir src/data
mv /path/to/myresume.md src/data/resume.md
vim astro.config.mjs # set base: '/resume'
vim src/pages/index.astro # render the resume
npm run dev # preview at http://localhost:4321/resume/
npm run build # static files are written to dist
Any text editor works in place of vim. It’s just been a long-time habit of mine to use vim when I edit text files quickly through command line interface. The exact contents of the two edited files are in steps 2.2 and 2.3 below.
Install Node.js first. node -v returns a version number once it is installed, and the macOS installer also installs npm.
npm create astro@latest resume-site scaffolds the project. This walkthrough chooses the minimal (empty) template, installs dependencies, and initializes a git repository.
Setting base: '/resume' in astro.config.mjs makes the site work at /resume instead of the main site address.
The Markdown resume lives in src/data as resume.md and is rendered by src/pages/index.astro through the Content component.
npm run dev previews the site at http://localhost:4321/resume/, and npm run build writes the static production files to dist.
Tested with
Component
Version or detail
Node.js
v26.13.0 (64-bit macOS installer from the LTS page)
npm
v11.20.0
create-astro
5.3.1
Astro
v7.4.7 (shown in the dev server output)
Starter template
Minimal (empty)
Operating system
macOS
Date tested
November 8, 2026
Versions and environment used in this walkthrough, taken from the terminal output and screenshots below.
Prerequisites
A Mac with a terminal. This walkthrough uses macOS, and paths such as /usr/local/bin come from the macOS installer.
Node.js, which you can get from the Node.js download page. Astro’s dev environment setup guide currently lists v22.12.0 as the minimum supported version and says odd-numbered versions are not supported (checked November 2026). This article uses v26.13.0.
A resume written in Markdown (a .md file).
A text editor. This article edits files with vim in the terminal, and includes the few vim keys you need.
Part 1: Prep your tools (install Node.js)
This part checks whether Node.js is already installed and, if it is not, installs it on macOS. Node.js and npm are needed for every Astro command used later.
I ran node -v in my terminal and it returned “not found”, so I installed Node.js on my Mac with the details below.
The 64-bit installer package installed the following:
Node.js v26.13.0 to /usr/local/bin/node
npm v11.20.0 to /usr/local/bin/npm
My Mac then asked whether I wanted to move the “node js” installer to the trash, and I said yes!
I closed and reopened the terminal, and node -v now returns v26.13.0. Sweet.
Part 2: Make the project (create the Astro site)
This part scaffolds a new Astro project named resume-site with the create-astro command and the minimal (empty) template, then adds the resume file, sets the base path, creates the index page, tests locally, and builds the static files.
Create a webproj folder in Documents and move into it:
cd Documents
mkdir webproj
cd webproj
Create the Astro project with the create-astro command:
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
> npx
> 'create-astro' resume-site
Figure 1: The create-astro prompt asking how to start a new project, with the starter template options listed.
Answer the questions that create-astro asks. Use the arrow keys to choose an option, then press Enter.
My answers:
tmpl How would you like to start your new project?
Use minimal (empty) template
deps Install dependencies?
Yes
git Initialize a new git repository?
Yes
Done for now. Here is the finished setup:
Figure 2: Final create-astro output for resume-site, showing the minimal template, installed dependencies, and an initialized git repository.
Omg, it created the initial commit for me. Saved mental resources, such as what to write as the commit message:
git log
commit 30521bd903ee79f2b87b4df4cb07a8a0cd417832 (HEAD -> main)
Author: houston[bot] <[email protected]>
Date: Sun Nov 8 17:21:25 2026 +0800
"Initial commit from Astro"
Move into the new project folder. Every remaining command in this guide runs from here:
cd resume-site
2.1 Add your resume file to src/data
Create a src/data folder inside the project and move your Markdown resume into it as resume.md so the index page can import it.
Create the data folder inside src:
mkdir src/data
Move your resume file into [...]/webproj/resume-site/src/data. Rename it to resume.md while moving it, because index.astro imports ../data/resume.md:
mv /path/to/myresume.md src/data/resume.md
2.2 Set the base path in astro.config.mjs
Replace the contents of astro.config.mjs with a configuration that sets Astro’s base option to /resume, so the site is served from the /resume path.
Open the Astro config file in vim:
vim astro.config.mjs
New to vim? You only need these keys. Type gg then dG to delete everything in the file. Press i to start typing, paste the code, press Esc, then type :wq and press Enter to save and quit. Any other editor works too.
What this does: the block between the --- lines imports Content from your Markdown file, <Content /> renders that file as HTML inside <main>, and the <style> block centers the text in a readable 42rem column. Change the <title> to whatever you want shown in the browser tab.
Save the file. Your project now contains these files (other generated files omitted):
Start the Astro dev server with npm run dev and open the /resume path on localhost port 4321 to preview the page.
Run npm run dev inside the resume-site folder:
npm run dev
Figure 4: The Astro dev server ready at http://localhost:4321/resume after running npm run dev.
It runs and displays the Markdown content as expected on http://localhost:4321/resume/. Because base is set to /resume, open that path rather than the plain http://localhost:4321/ address.
Press Ctrl+C in the terminal to stop the server.
2.5 Build the real files with npm run build
Run npm run build to generate the static production files, which Astro writes to the dist folder.
Run the build command:
npm run build
Built! Here is the build output:
Figure 5: Output of npm run build, ending with Complete! after Astro generates the static route.
Because base is /resume, the files in dist should be served from the /resume path on your site.
Troubleshooting
These are the problems most likely to come up in the steps above, based on how each step works.
Symptom
Likely cause
Fix
node -v says “not found”
Node.js is not installed, or the terminal was opened before the install finished.
Install Node.js from the download page, close and reopen the terminal, then run node -v again.
Astro commands fail on an old Node.js
Your Node.js is older than Astro’s minimum, or is an odd-numbered version.
base is set to /resume, so the page lives under that path.
Open http://localhost:4321/resume/ instead.
An error about ../data/resume.md not being found
The resume file is missing from src/data or has a different name.
Make sure the file is exactly src/data/resume.md, or change the import path in index.astro to match your file name.
Common problems in this setup and how to fix them.
Summary
You now have an Astro project named resume-site that renders a Markdown resume at /resume. It was previewed locally at http://localhost:4321/resume/ and compiled to static files with npm run build. Because base is set to /resume, the page is served at the /resume path instead of the main site address.
Catzie’s Qualms re using Astro specifically for a one-page resume site
The site I created was just a resume with 1 page. When it was time to add Google Analytics tracking code, it didn’t feel right to open the .astro file again and rebuild just to copy-paste again to my web hosted file. I think if I want to keep Astro as that resume site’s framework, I’d setup a form of CI/CD. Otherwise, I’ll keep it simple with good ol’ HTML + CSS and a dash of JavaScript as needed. At this point, I am not really very familiar with coding in node.js yet! I simply followed other guides to do what I did here. Maybe that’s one thing I’ll try in the near future. 🙏
Key terms
Astro
A web framework for building content-driven websites. This article uses it with the minimal template to generate a static page from a Markdown file.
Node.js
A JavaScript runtime. Astro’s command-line tools run on it, so it must be installed first.
npm
The package manager installed alongside Node.js. It runs the create, dev, and build commands in this article.
Base path
The URL subpath a site is served from. With base set to /resume, Astro uses that path as the root for pages and assets in development and in the production build.
Content component
A component Astro makes available when you import from a Markdown file. It renders the file’s full body as HTML, which is how index.astro displays the resume.
Static build
Pre-generated files produced by npm run build. Astro writes them to the dist folder.
Frequently asked questions
How do I check whether Node.js is installed on a Mac?
Run node -v in the terminal. A version number such as v26.13.0 means Node.js is installed. A “not found” message means it still needs to be installed, which is what happened at the start of this walkthrough.
Which Node.js version does Astro need?
Astro’s dev environment setup guide lists v22.12.0 as the minimum supported version and says odd-numbered versions are not supported (checked November 2026). This walkthrough used v26.13.0.
What does the base option in astro.config.mjs do?
The base option sets the path the site is served from. With base: '/resume', the page works at /resume instead of the main site address, and the dev server URL becomes http://localhost:4321/resume. Astro’s configuration reference describes it as the base path to deploy to, used as the root for pages and assets in both development and the production build.
Which Astro starter template does this tutorial use?
It uses the minimal (empty) template, answers Yes to installing dependencies, and answers Yes to initializing a git repository. The contents of src/pages/index.astro are then replaced with a page that renders the Markdown resume.
How does the index page display a Markdown resume?
The page frontmatter imports Content from ../data/resume.md, and the page body renders it with a <Content /> component inside a <main> element.
What URL does the Astro dev server use, and how do I stop it?
In this walkthrough, npm run dev started the dev server at http://localhost:4321/resume. Press Ctrl+C in the terminal to stop it.
Why doesn’t http://localhost:4321/ show my resume?
Because base is set to /resume, the resume page lives under that path. Open http://localhost:4321/resume/ instead of the plain localhost address.
What does npm run build produce?
It generates the static production files. In the build output in this article, Astro reports a static output, builds one page, and writes the files to the dist folder inside the project.
Where do I put the built files so the resume works at /resume?
Serve the files from the dist folder at the /resume path on your site. Because base is set to /resume, the built page expects to be reachable there rather than at the main site address.
How do I edit files in vim if I have never used it?
Open the file with vim filename. Type gg then dG to delete all existing lines, press i to start typing, paste your code, press Esc, then type :wq and press Enter to save and quit. Any text editor works as well.
Does create-astro create a git commit automatically?
When you answer Yes to initializing a git repository, the project starts with an initial commit. In this walkthrough, git log showed a commit authored by houston[bot] with the message "Initial commit from Astro".
Life involves a lot of problem solving. Today, my first one was this: I had forgotten the username and password for one of my GitHub repos, and my current Mac had no SSH keys set up. I don’t regularly work on this repo (an Android app), and I’ve changed devices since I was last active on this project.
Tested on: a Mac running a macOS version Tahoe 26.6.2 using an ed25519 key.
Quick answer: how to fix “Authentication failed” on git push by using SSH keys
A TL;DR for fellow impatient people. 🤪
If git push fails with “Authentication failed” and your Mac has no SSH keys, create an ed25519 key with ssh-keygen, add it to the SSH agent, and add the public key to your GitHub account under Settings → SSH and GPG keys. Then, remember to change your repo’s remote URL from HTTPS to SSH with git remote set-url!
Switch your repo’s remote to the SSH URL with git remote set-url origin [email protected]:USERNAME/REPO.git.
And for those who want to dive in to more details, read on~
The problem: git push says “Repository not found” and “Authentication failed”
I tried to push to my repo, and Git asked for a username and password I no longer remembered. Entering anything failed with the error below.
me@my-MacBook-Pro My-App % git push
Username for 'https://github.com':
Password for 'https://github.com':
remote: Repository not found.
fatal: Authentication failed for 'https://github.com/catzie/My-App.git/'
Since I had no SSH keys on this device, it was time to set them up.
Step-by-step: set up SSH keys for GitHub on a Mac
Step 1: Check for existing SSH keys
First, I checked whether any keys already existed on my Mac:
ls -al ~/.ssh
It found nothing, so I went ahead and created one.
Step 2: Generate a new ed25519 SSH key
I created a new SSH key with this command (replace the email with your own):
Here is the response I got from the terminal. It asks where to save the key and for an optional passphrase (you can leave it empty for no passphrase).
Generating public/private ed25519 key pair.
Enter file in which to save the key (/Users/me/.ssh/id_ed25519):
Created directory '/Users/me/.ssh'.
Enter passphrase for "/Users/me/.ssh/id_ed25519" (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/me/.ssh/id_ed25519
Your public key has been saved in /Users/me/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:gca01y4Nhsp3ZhFrUnY8ty6VPQiNjBEIt7IVbnFqdx4 [email protected]
The key's randomart image is:
+--[ED25519 256]--+
| ..=.B*.o |
| =.%.=* o |
| . # X E+ = |
| . O * O .= o |
| + . S +o . |
| . + .. . |
| . |
| |
| |
+----[SHA256]-----+
Step 3: Start the SSH agent
Next, I started the SSH agent:
eval "$(ssh-agent -s)"
This showed me Agent pid 1234. The number at the end will vary.
Step 4: Create the SSH config file (macOS newer than Sierra 10.12.2)
Since I use a macOS version newer than Sierra 10.12.2, I had to edit an SSH config file. I tried to open it first:
open ~/.ssh/config
The file /Users/me/.ssh/config does not exist.
As you can see, the terminal told me the file doesn’t exist yet. I habitually use vim to quickly edit text files in the terminal, and to create nonexistent ones:
vim ~/.ssh/config
This opens a blank text file named “config” located at ~/.ssh/.
I pressed the i key to enter vim’s INSERT mode, and then pasted the following text:
Trivia: what does the ~ in ~/.ssh/id_ed25519 mean?
In Mac and Linux terminals, the ~ symbol automatically translates to your user’s home directory, which on a Mac is usually /Users/YourUsername. If your Mac username is me, the terminal reads ~/.ssh/id_ed25519 and expands it to /Users/me/.ssh/id_ed25519 behind the scenes.
Note: if you chose not to use a passphrase, you may omit the UseKeychain line from the config.
If you see a “Bad configuration option: usekeychain” error, add an IgnoreUnknown UseKeychain line to the same Host github.com section of the config, above the UseKeychain line:
Now it’s time to add the key to my GitHub account! I copied the contents of my public key file (~/.ssh/id_ed25519.pub) to my clipboard with this command:
pbcopy < ~/.ssh/id_ed25519.pub
Step 7: Add the public key to your GitHub account
In my web browser, I went to github.com and navigated to Settings → SSH and GPG keys. I entered the title I wanted to label this key with, and selected Authentication Key as the key type. For the key itself, paste the contents of the local ~/.ssh/id_ed25519.pub file from your machine.
Step 8: Test your SSH connection to GitHub
After setting up the key with GitHub, I tested the SSH connection:
It worked! The screenshot below shows the response I got. Note that every user connecting toGitHub.comvia SSH usingED25519sees that exact same fingerprint: SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
Step 9: Switch your Git remote from HTTPS to SSH
Time to test on the real thing: pushing my new Android app commits. But Git still prompted me for a username and password!
This is because my Git remotes were still pointing to HTTPS URLs instead of SSH. I confirmed it with:
Finally, I ran git push again within my Android Studio project and it successfully did as told. 😎 This is because the git remote is now pointing to the SSH URL, and should authenticate with the SSH key instead of prompting me again for username and password (which I already remembered! But not willing to type over and over again!)
Common problems and fixes
Problem
Cause
Fix
git push shows “Repository not found” and “Authentication failed”
Forgotten GitHub credentials and no SSH keys set up on this device
Follow steps 1 to 9 above to set up an SSH key
git push still asks for a username and password after adding the SSH key
The Git remote still points to an HTTPS URL
Run git remote set-url origin [email protected]:USERNAME/REPO.git (step 9)
“Bad configuration option: usekeychain”
The UseKeychain option isn’t recognized
Add IgnoreUnknown UseKeychain to the Host github.com section, above the UseKeychain line (step 4)
open ~/.ssh/config says the file does not exist
The config file hasn’t been created yet
Create it with vim ~/.ssh/config (step 4)
No passphrase set on the key
The keychain options are only needed for passphrases
Omit the UseKeychain config line and the --apple-use-keychain flag
Frequently asked questions
Why does git push still ask for my username and password after I set up an SSH key?
Your Git remote is probably still using an HTTPS URL. Run git remote -v to check. If it shows https://github.com/..., switch it to the SSH URL with git remote set-url origin [email protected]:USERNAME/REPO.git.
How do I check if I already have SSH keys on my Mac?
Run ls -al ~/.ssh in the terminal. On my Mac it found nothing, which is how I knew I needed to create a new key.
Do I need a passphrase for my GitHub SSH key?
The ssh-keygen prompt lets you leave the passphrase empty. If you choose no passphrase, you can omit the UseKeychain line from your ~/.ssh/config and the --apple-use-keychain flag from ssh-add.
How do I test my SSH connection to GitHub?
Run ssh -T [email protected] after adding your public key to your GitHub account. Every user connecting to GitHub.com over SSH with ED25519 sees the same fingerprint, SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
How do I fix the “Bad configuration option: usekeychain” error?
Add the line IgnoreUnknown UseKeychain to the Host github.com section of ~/.ssh/config, above the UseKeychain line.
Which macOS versions need the SSH config file?
I needed it because I use a macOS version newer than Sierra 10.12.2. The config file tells SSH to add your key to the agent automatically, to use the keychain, and which identity file to use for github.com.
Command cheat sheet
All the commands from this guide, in order. Replace the email, username, and repo name with your own.
# 1. Check for existing keys
ls -al ~/.ssh
# 2. Generate a new ed25519 key
ssh-keygen -t ed25519 -C "[email protected]"
# 3. Start the SSH agent
eval "$(ssh-agent -s)"
# 4. Create the SSH config file
vim ~/.ssh/config
# 5. Add the key to the agent (omit --apple-use-keychain if no passphrase)
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
# 6. Copy the public key, then paste it into GitHub
pbcopy < ~/.ssh/id_ed25519.pub
# 7. Test the connection
ssh -T [email protected]
# 8. Switch the remote from HTTPS to SSH
git remote -v
git remote set-url origin [email protected]:USERNAME/REPO.git
In response to the recent PHP vulnerability issue, I spent some time here in this blog site to upgrade my WordPress theme, plugins, WordPress installation itself, and finally, the PHP version.
One minor issue was encountered after upgrading plugins — Head, Footer and Page Injection plugin began showing parts of some code that I inserted, as plain text in my blog site!! I noticed that the plugin had a notice stating that “php is not allowed in your code (disabled by your theme or a plugin)”. The fix that worked was to head over to the plugin’s settings page (Settings -> Head and Footer) and then go to the ‘Advanced’ tab, and then toggle on the setting labeled as “Enable PHP execution”.
The PHP version I was using was quite outdated T_T and so upgrading to version 8.0 broke my blog site with the error “there has been a critical error on this website.” Fortunately, the thing that I deactivated first was the exact cause of error: my old, outdated theme! It was “Sparkling” theme, which I hadn’t touched for years. I changed into the Twenty Twenty-Five theme for a fresh look and updated WP code. Thank you, Colorlib for the Sparkling theme — it served me well for several years!
I feel good after taking the time to update this site. I’ve had this for over a decade now.
Setting up Android Studio on a freshly reformatted MacBook, I got this error: Git is not installed xcode-select: note: No developer tools were found, requesting install. If developer tools are located at a non-default location on disk, use sudo xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools, and cancel the installation dialog. See man xcode-select for more details.
I wanted to do something with my Android phone using ADB commands, while keeping it plugged in to run the said commands. However, the thing I wanted to test was related to the idle (dozing or asleep) mode of Android devices. The workaround was to spoof the battery state to bypass Android’s charging restrictions.
Spoofing Battery Charging Status and Forcing Android Device to Sleep (Idle Mode)
Turn off the device screen using the physical power button.
Trick Android into thinking the device is running on battery power: adb shell dumpsys battery unplug
Force the device to step into deep Doze mode: adb shell dumpsys deviceidle force-idle
Verify the device is successfully spoofed and asleep: adb shell dumpsys deviceidle get deep(This should return IDLE).
Can also do: adb shell dumpsys battery unplug && adb shell dumpsys deviceidle force-idle && adb shell dumpsys deviceidle get deep
Device Cleanup for Spoofed Battery and Forced Sleep (Crucial!)
Once testing is done, you must tell the OS to start reading the actual battery state again, otherwise it won’t charge properly: adb shell dumpsys battery reset
Bring the device out of idle: adb shell dumpsys deviceidle unforce
Can also do: adb shell dumpsys battery reset && adb shell dumpsys deviceidle unforce && adb shell dumpsys deviceidle get deep
To target my specific emulator devices on Android Studio with my ADB (Android Debug Bridge) commands, I usually need to type long ones, like in the commands below where i wanna list the contents of a directory:
adb -s emulator-5554 ls /sdcard/Android/sub/directory/ adb -s emulator-5556 ls /sdcard/Android/sub/directory/
When I am working on a new feature or a bug-fix ticket, I try to avoid typing long commands and args over and over again, especially args that are as error-prone as emulator-5554.
How to shorten the ADB commands that target emulators (Mac OS):
Open your Zsh config file with an editor. Mine by habit is Vim. Like so: vim ~/.zshrc
Use your arrow keys to go to the very bottom of the file and copy-paste below exact code:
What it does is creates a new command adbs. I think the addition of s at the end is appropriate because the flag we are trying to work with is the -s flag which stands for “Serial”, for identifying specific emulators.
The way the new command works is,
the $1 captures the first argument you type after adbs and saves it — for example, the 54 in adbs 54.
The shift bit removes the first argument from the front so that the actual command to be run will NOT be adb -s "emulator-5554" 54 logcat (wrong!)
Finally, the last line adb -s "emulator-55$port" "$@" runs the correct command, inserting the first argument (54 in our example) where $port is, followed by "$@" which grabs the rest of the command after the 54
Save the changes to the config file and then exit the editor. In Vim I press Esc key, then type :wq! and hit Enter. IIRC my partner questions something about my :wq! usage, but what he points out, I can’t remember.
After saving the config file, run the following command to make the new shortcut work immediately:
source ~/.zshrc
Usage Example:
Instead of typing the long version: adb -s emulator-5554 ls /sdcard/Android/sub/directory/
We can just type: adb -s 54 ls /sdcard/Android/sub/directory/
Extra: to know what serial numbers of running devices you got, run below command
adb devices
Random thoughts: I am grateful to my very first team lead as a software developer (Peng) because he’s the one who inspired me to become comfortable with command line interfaces. Remembering how much I grew as a dev in that team due to high-traffic production databases that we were managing and debugging in realtime. Oh, the source command on the other hand, was something I learned from my current team lead, Maru. I like how much I am growing in this current team, not only as a dev, but also as a person.
Credit goes to Google Gemini for the above adbs custom command. I had no idea how to write that until today. hehe