Search code examples
gitgit-guigit-bare

Git GUI fails to identify bare repository while TortoiseGit succeeds


While I understand the difference between a bare and non-bare Git repositories, I am puzzled by how a bare repository is not identified as a valid repository by git-gui (despite successful push via Git Bash), while TortoiseGit has no issue identifying it as such (right-click inside Y:\as > TortoiseGit > Repo-browser):

TortoiseGit with bare repo

Git Gui, on the other hand responds to the same exact Y:\as path with an error:

Git Gui error Not a Git repository

This is the same Git Gui that came with the official Git distribution:

Git Gui version

Any idea why is? Is this a bug? as designed?

BTW, git-gui has no issue browsing the working directory matching same exact push/repo:

git-gui on working directory


Solution

  • The screen capture you posted shows gitk, a GUI frontend to git log which will indeed work on any kind of repository -- bare or non bare. It is a tool independant from git-gui which can be run on its own, by simply invoking gitk from a terminal, or by double-clicking a shortcut if you have one.

    From the view you show in your capture: you can see that you have a Help > About gitk entry in the menu.

    Since you mention git gui, I imagine you are used to accessing this view by first running git gui, then selecting Repository > Visualize [my branch]'s History (or Repository > Visualize All Branch History)


    git-gui itself, on the other hand, is geared towards editing your index (the files you stage or unstage before committing) by comparing it to your working tree (files on disk), and this requires a non-bare repository, which is why you get the error you mention when you try to target a bare repository.


    Additionally, when invoking gitk from the command line, you can add almost any option you would pass to git log :

    gitk                        # history of your active branch
    gitk HEAD @{u}              # combined history of active branch + upstream
    gitk foo bar origin/baz     # combined history of these 3 branches
    gitk --all                  # combined history of all branches
    gitk --follow -- that/file  # display only commits that modify that/file
    gitk -G 'that word'         # filter history using one of the pickaxe options
    # etc ...
    

    you may also change these git log options on an active gitk window by going to View > Edit view ... [F4] and setting the options in the graphical window you see.