Clumsy cat
Clumsy cat

Reputation: 299

"git branch -v" takes a long time, quicker way to get current branch name?

So the repo I'm working in is a selective checkout of a big repo. The server I'm working on has also seen better days. If I wanted to know what branch of a repo I was on, I'd normally do git branch -v, but last time I did that it took 3 minutes and 58 seconds.

Any way I can have just the name of the current branch a bit quicker than that? Surely it's stored in that .git folder somewhere?

Upvotes: 0

Views: 67

Answers (2)

VonC
VonC

Reputation: 1325377

Check if git branch --show-current (since Git 2.22, Q3 2018) would be faster.

That way, you would not have to post-process git branch -v.

Upvotes: 1

ewokx
ewokx

Reputation: 2425

Another option is to use git status, which does show which branch is the current branch.

Upvotes: 1

Related Questions