DEV Community

Cover image for Copy the name of your current branch
Domenik Reitzner
Domenik Reitzner

Posted on

1

Copy the name of your current branch

I just wanted to share a quick helper that I have been using for a while.

History

One of the projects I work at has some nicely set up development servers (different variations of cms and business api).

So whenever we need to test a specific configuration on a feature that we are developing, we will put that branch on one of the development servers. For that to happen we need to adapt the configuration inside of the build server and change the branch name.

So after multiple times of changing the branch name, waiting for the build to finish, testing on the server, not seeing my changes and finding out, that I had a typo in the name, I decided I'd hunt for a better solution.

The easy fix I've used ever since.

This is the easy solution I found:

// windows
git branch --show-current | clip
Enter fullscreen mode Exit fullscreen mode
// macOS
git branch --show-current | pbcopy
Enter fullscreen mode Exit fullscreen mode

I hope ths makes your live easier and you can focus more of your time on the things you love to do.

Credits

cover: https://unsplash.com/@yancymin

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 (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more