Forem

Rudi Farkas
Rudi Farkas

Posted on

1

git aliases

Hey, devs!

Here are a few of my git aliases -- I like using git from the command line.

Feel free to try them and let me know if you're interested in learning more about how and why I use them.

Even better, present us some of your own -- I'd love to see them!

### git trb <commit> ### tag and rebase on commit
trb = "!f() { bra=$(git rev-parse --abbrev-ref HEAD);  git tag ${bra}-BAK;      git rebase ${1}; }; f"

### git trbi <commit> ### tag and rebase interactively on commit
trbi = "!f() { bra=$(git rev-parse --abbrev-ref HEAD); git tag -f ${bra}_BAK;   git rebase -i ${1}; }; f"

### git tsqn <n> ### tag and squash last n commits
tsqn = "!f(){ bra=$(git rev-parse --abbrev-ref HEAD);  git tag -f ${bra}_BAK;   git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%s --reverse HEAD..HEAD@{1})\"; }; f"

### git tsqc <commit> ### tag and squash on top of the commit
tsqc = "!f(){ bra=$(git rev-parse --abbrev-ref HEAD);  git tag -f ${bra}_BAK;   git reset --soft ${1} && git commit --edit -m\"$(git log --format=%s --reverse HEAD..HEAD@{1})\"; }; f"

Enter fullscreen mode Exit fullscreen mode

@rudifa

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (1)

Collapse
 
rudifa profile image
Rudi Farkas

Here is an example of my workflow

  • work for a couple of hours on a feature, commit often (some good, some to be fixed)

Image description

  • when the feature is done, squash all intermediate commits into a single final commit:
ad-astro-d3-demos % git tsqc main 
Enter fullscreen mode Exit fullscreen mode
  • later, when all is stable, remove the _BAK tag

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay