git worktree allows you to checkout multiple branches at the same time. It’s somewhat similar to git checkout -b except that it will create the branch at a new path.
For example, running this command in your repository will create a new example-worktree folder outside of your repository and a new git branch named example-worktree
$~ git worktree add ../example-worktree
If you have an existing branch that you want to use worktree with, you need to run the following command instead
One thing that I noticed when using worktree is that you can’t checkout to the same branch that’s already in worktree. For example, I can’t checkout to example-branch from main branch.
git worktree is a pretty useful feature but I would recommend you use it sparingly. It can get confusing if you have too many worktree available. I would recommend you to remove it once you’re done with it.
Hopefully you find this helpful as a quick references.
I was having some issues with my PHP package installed through asdf yesterday. Something about missing libiconv and when I ran php -v it returns me this response:
I’ve been using zsh with antigen as the package manager for years. Over time as I add more customizations, I noticed that my shell startup time has become slow. Sometimes, it would take more than 3 seconds to start up.
I read few months (or a year) ago that nvm, a version manager for nodejs can cause this issue so I thought maybe it’s the right time I should try asdf.
asdf is basically just another tool to manage versions but instead of having to install multiple tools like rbenv for ruby or nvm for nodejs, you can just use asdf and use its plugins to manage all the language versions that you’re using.
Anyway, I’m not going to talk about what’s so good about it. For that, you can read the docs yourself. I’m just going to document the steps I did here.
First of all, I have to completely remove nvm. Here are the steps:
# list out all the nodes version I'm using$~ nvm ls
# uninstall nodejs$~ nvm uninstall <NODEJS_VERSION>
# uninstall nvm with brew (since I install it using Brew)$~ brew uninstall nvm
# delete related dotfiles and directory$~ rm -rf ~/.nvm/ ~/.nvmrc
I made a thing! It’s an iOS app to remotely manage Gitlab runners. I wrote this app to solve one of the pain points that I frequently face back when I managed the CI/CD machine that hosted the Gitlab runners for my teams.
My coworkers would frequently ask me to check why their pipelines or runners were failing and so in a begrudging manner, I would VNC’d into the machine and checked them.
so…
๐ฅ๐ฅ๐ฅ
TADAA!
This app solved these problems by providing an easy access for me to:
Quickly check the runners status
Pause, resume, or delete a runner remotely
Oh! Did I mentioned that this is my first SwiftUI and paid app? SwiftUI is really fun to write but there are some weird bugs that Apple needs to fix still.
Anyway, it’s available now on the App Store for the price of US$1.99 or MYR 7.90.
You work on a large project that has an extensive git commits history and a lot of files
You need to debug a certain issue that was caused by a certain file
You look at the commits history to see which commit is causing the issue but going through it one by one is like finding a needle in a haystack
Well, worry not because you can use the following git log command to solve your issue:
$~ git log --follow -- path/to/file.txt
This will list down all the commits history for that specific file. It will work even if the file was deleted or renamed. However please be aware that it will only work for a single file at a time.