heug heug - 3 months ago 8
Git Question

Is there a way on Git to retrieve a branch whos name I forgot? One that hasnt been pushed to or upstream set

Earlier today, I created a branch with a rather long, kebab-cased name and have come back to my computer later to realize maybe it was too long, as I dont really remember the exact order for the array of words chosen.

I dont see the branch as available on bitbucket because (i assume) it hasnt been pushed to and/or the upstream has not been set on it.

How can I retrieve it? is there any way to see a log of branch checkout activity?

I had already closed the terminal window wherein I cut the branch originally, so i cant find it by pressing thru terminal history.

if i knew some keywords of the branch, is it possible run

git grep


with some kind of parameters to find it?

Answer

You can list all branches with

git branch -a

So maybe

git branch -a | grep keyword will help