Author Topic: C::B plugin to show current git branch?  (Read 5235 times)

Offline cacb

  • Lives here!
  • ****
  • Posts: 547
C::B plugin to show current git branch?
« on: April 10, 2025, 11:19:43 am »
The question is in the subject. Does a C::B plugin exist to show current git branch somewhere in the IDE, for example in the task bar?

I sometimes make mistakes forgetting what the current branch is, so this would be useful to me.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7779
    • My Best Post
Re: C::B plugin to show current git branch?
« Reply #1 on: April 10, 2025, 05:59:13 pm »
I believe the GitBlocks does this it is a third-party plugin that I updated a year or two back.
But for what you want that is over kill. I would use the CB Toolplus plugin and likely use the "git branch --list" command to display the information.

Edit: Both of the above does it in a log tab instead of a place in the status toolbar.

Tim S.
« Last Edit: April 10, 2025, 06:01:07 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cacb

  • Lives here!
  • ****
  • Posts: 547
Re: C::B plugin to show current git branch?
« Reply #2 on: April 11, 2025, 08:18:38 pm »
Thanks for the info., I will look into it.

It would be nice if it could be directed to a field in the status bar.

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: C::B plugin to show current git branch?
« Reply #3 on: April 12, 2025, 10:50:20 am »
This is a useful feature, I'll try to add it to cbvcs plugin.

Offline cacb

  • Lives here!
  • ****
  • Posts: 547
Re: C::B plugin to show current git branch?
« Reply #4 on: April 12, 2025, 04:50:03 pm »
It is very nice to add that feature to the cbvcs, thank you for considering it.

I could not find cbvcs among the standard plugins, but I found it at https://github.com/josephch/cbvcs

Trouble is, I use C::B a lot under windows and for that I rely on the Windows nightly builds (that I do not build myself) available via this forum. The nightly builds work perfectly fine, but there does not seem to be an easy way to install a plugin like cbvcs in this situation. Or maybe I am mistaken?

On Linux I do build C::B from source, so that is slightly different I suppose, but the main need is currently on Windows using C::B nightly builds.

Ideas welcome.

----
Edit: By the way, I currently "integrate" git with Code::Blocks in a super simplified way: I simply add a "Git Gui Here" option in the C::B Tools menu with ${PROJECT_DIR} as working directory. That way I have access to most most git features that I care about and it works the same on Windows and Linux. For special git features I can use another "Terminal here" option in the C::B Tools menu.

if I could use the Tools plugin (or Tools+ if you insist) to assign a string to some C::B variable to be mirrored in the taskbar it would work without the need for a whole new plugin.
« Last Edit: April 12, 2025, 05:09:59 pm by cacb »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7779
    • My Best Post
Re: C::B plugin to show current git branch?
« Reply #5 on: April 13, 2025, 04:01:20 am »
Code
git branch --show-current

Shows current branch
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline christo

  • Multiple posting newcomer
  • *
  • Posts: 48
Re: C::B plugin to show current git branch?
« Reply #6 on: April 13, 2025, 06:53:55 am »
Trouble is, I use C::B a lot under windows and for that I rely on the Windows nightly builds (that I do not build myself) available via this forum. The nightly builds work perfectly fine, but there does not seem to be an easy way to install a plugin like cbvcs in this situation. Or maybe I am mistaken?
Hi cacb, you are right,  installing without source code is not possible unless nightly installation contains header files as well. Also, I've never built the plugin for Windows as I don't have a Windows machine I use for development.

I just added the feature to cbvcs plugin as it is useful for me.

Just changes is plugin is not enough, CB core code also need some changes. For any other plugins to show the branch also similar change is required. Attaching the change.

Thanks, Christo

Offline cacb

  • Lives here!
  • ****
  • Posts: 547
Re: C::B plugin to show current git branch?
« Reply #7 on: April 14, 2025, 11:46:34 am »
I just added the feature to cbvcs plugin as it is useful for me.
Thanks, I appreciate your efforts even though it it is not available to me using Nightly Builds on Windows