jimeh / git-aware-prompt

Display current Git branch name in your terminal prompt when in a Git working directory.
Creative Commons Zero v1.0 Universal
2.15k stars 340 forks source link

Tag names #26

Open jordi-adell opened 8 years ago

jordi-adell commented 8 years ago

I added this code to get tag names in case you checkout a specific tag. Instead of just writing detached* as branch name.

You might want to include it the your main repo. I did not tested it extensively, but I will be actively using this fix from now on and will maintain it if necessary.

jordi-adell commented 8 years ago

I have been using this patch for months now, with several repositories, several machines, and a variety of versions of Ubuntu and Debian. No bug found, yet.

jimeh commented 8 years ago

Cool, I'll try to have a proper look at this week and merge it in :)

joeytwiddle commented 8 years ago

Thanks jordi, I have been using your code since November and I like it!

But there is one situation where it looks odd: during a rebase. To reproduce:

With this simple fix I changed the undefined back into *detached during a rebase. You are both welcome to use that if you like.

I did also add some lines which detect and display when we are rebasing or merging, but they will be trapped in the office until next Monday. ;)

joeytwiddle commented 8 years ago

Here is how to detect when we are stuck on a rebase, a merge, or a cherry-pick: https://github.com/joeytwiddle/git-aware-prompt/commit/1c87a4bb474e7b10bec3f8d6605761237b94d998

jimeh commented 8 years ago

@joeytwiddle Very nice :)...

I'll be spending some time on a proper update for git-aware-prompt soon. I personally haven't used the project since about 5 years ago when I switched to zsh. So the goal is to incorporate a lot of these kind of improvements, and make it compatible with both bash and zsh, so I can start using it myself again too.

jordi-adell commented 8 years ago

@joeytwiddle Good to know that the patch was useful.