Skip to Main Content
TWIL
git
Katie demonstrating Git alias configuration on a computer screen, promoting efficient and inclusive Source Control Management practices.

Welcome to another enlightening edition of TWIL, the series dedicated to fostering continuous learning in the ever-evolving landscape of software development. This week, join Katie as she navigates the trail of Git aliases with default branch complexities. Her insights dive into creating adaptable Git aliases amidst the shifts from "master" to more inclusive terms like "main" or "primary," streamlining your Git workflow with precision and inclusivity. Save time and prevent hiccups by harnessing her tips to refine your Source Control Management practices, ensuring your Git experience stays ahead of the curve.

Git aliases with default branch

Git aliases that assume that your default branch is called "master" can be problematic (for example; having "develop" as the default branch, or the industry shift to "main", "primary". etc., etc.)

default = "!f() { git remote show ${1:-'origin'} | grep 'HEAD branch' | sed 's/.*: //'; }; f"

Some other aliases that build off of this one that I've found helpful:

cd = "!f() { git checkout $(git default); }; f"

rd = "!f() { git rebase $(git default); }; f"

up = "!f() { git remote update origin && git pull origin ${1:-$(git default)}; }; f"

update = "!f() { git cd && git up && git co - && git rd; }; f"
  • git
Katie Linero's profile picture
Katie Linero

Senior Software Engineer

Related Posts

Digital pioneer journeying through technological quirks, reminiscent of vast waterfalls and rocky terrains
April 5, 2017 • Kyle Misencik

Infinitely dispatching actions + React, Redux & React Router v4

While implementing JWT for an application, we ran into a quirk with React Router v4. Here, we hope to show how to implement protected client-side routes while avoiding some of the pitfalls we encountered.

Katie presents a Ruby on Rails coding tip on selecting a random record from a database model in the TWIL series.
February 2, 2021 • Frank Valcarcel

TWIL 2021-01-29

Dive into this week’s TWIL where Katie uncovers a quick Ruby on Rails tip—fetching random records with elegance. Elevate your coding with a versatile method.