Bits and bytes of code

Bytes is my collection of short-form posts, tips, and things I learn as I build software.

Showing results for #git

Clear

If you've ever had to debug a live issue, you may have had to diagnose specific commits to determine if they could have been the cause of the issue. You might have a suspect commit, but how can you easily tell if that commit is included in the release of the app at the time of the issue?

I previously wrote a Byte about the commit-url command that I created and use frequently to copy the GitHub commit URL of the current commit. The main body of that command was determining the remote URL which can now be simplified given the new remote-url command I wrote about yesterday.

I have several bash scripts that require the remote URL of a Git repository, so a while back I wrote a script to build the URL. I recently rebuilt it with support for SSH host aliases.

One challenge I ran into recently after starting a new role at Ramp was managing SSH authentication multiple GitHub accounts. Being able to access personal repositories like my dotfiles while also accessing work repositories which are managed by a separate GitHub enterprise account was something I hadn't done before.

Old Git branches that are already merged can very quickly clutter your local repository. This can make it more difficult to find active branches you are working on. With a simple shell script we can clean up these old branches.

If you find yourself switching branches frequently and getting frustrated with typing out long branch names, or hitting tab way too many times to get to the branch you want to switch to, I might just have a solution for you!

Keeping your Git branches clean in your local repo is very helpful to make it easy to switch between branches you are currently working on. The last thing you want is a bunch of old branches that have already been merged showing in your list of branches when running git checkout.

I frequently switch between Git branches inside of Neovim using Telescope, but it's also handy to be able to switch branches using fuzzy find when outside of Neovim.

I've started to use git worktrees more lately but one of the pain points I had was that they don't copied ignored files such as .env files. I found I was able to improve this workflow by adding a post-checkout hook.