Search code examples
gitgit-gui

How can I force the repository chooser in git gui


I put my home directory under version control. If I now start git-gui from my Gnome panel I can only work on this repository. The dialog that lets me browse for or enter a repository location or pick one that I used before is no longer there.

I could not find an according commandline or .gitconfig switch.

How can I force git-gui to display the dialog?


Solution

  • Create a file with the following contents and mark it executable:

    #!/bin/sh
    cd /
    git gui
    

    Save that file somewhere in your PATH (e.g. /usr/bin/my-git-gui). Then change your gnome-panel launcher to point to that file instead of git gui.

    (git gui issues the prompt you want only if the working directory is not in a git repo. gnome-panel launchers set the working directory to ~, which in your case is a git repo; the script above is just a wrapper that sets the working directory to something that's hopefully not a git repo.)