2

Is there a way to start gitk on the master branch of a repo from git gui command line ? I had a look at the doc, the only thing that seems possible is to open a browser on the repo, not showing history.

Any clue ? Thanks

GaTTaCa
  • 459
  • 6
  • 18

1 Answers1

7

Presumably you mean something like git gui gitk should launch the gitk program in the current repository on the current branch. git-gui doesn't provide that, but you can of course just enter gitk on the command line and launch gitk itself and it will show the current branch history. Use gitk & if you are using a unix-style shell and want it disconnected from the console.

patthoyts
  • 32,320
  • 3
  • 62
  • 93
  • That's what I was afraid of. It's a shame that for once, a unix tools' GUI is more powerful than its command-line version. For some reason, I do not want to launch gitk directly, so I'll have to figure a kludge. Thanks anyway. – GaTTaCa Dec 16 '13 at 13:40
  • I can't really see any reason you want need to do this. If you just want to have one 'git' command expose all other git commands then you can create a git alias, or a script called 'git-gitk' that just execs gitk for you when you type 'git gitk'. – patthoyts Dec 16 '13 at 13:58
  • Actually I'm developing on Windows where only _git_ is an exe (and _gitk_ a unix bash script). So I am unable to launch gitk directly so I wondered if I could do that with the git gui command (I also cannot assume that something like _sh.exe gitk_ would work on every context in Windows). – GaTTaCa Dec 16 '13 at 14:05
  • 4
    Ok. Thats not really true. The Git\cmd folder has two wrappers in it. git and gitk so that if you install git for use with Windows command prompt you get both commands. The gitk wrapper is a batch script (gitk.cmd). If you add that folder to your PATH and not Git\bin then you should be fine. – patthoyts Dec 16 '13 at 14:26
  • 1
    Did not know that and this is exactly what I've been looking for! That's brilliant, @patthoyts – GaTTaCa Dec 16 '13 at 16:45
  • This would have been helpful for me. I'm storing dotfiles in a bare repo and supply the work-tree as a flag in an alias. Basically I can do `dotfiles add .`, `dotfiles gui`, etc. but `gitk` returns "Cannot find a repository here". Using the `git` command I could supply a work-tree flag, but it looks like `gitk` just runs `git rev-parse --show-toplevel` so I get an error "Error in startup script: fatal: this operation must be run in a work tree". https://www.anand-iyer.com/blog/2018/a-simpler-way-to-manage-your-dotfiles.html https://github.com/git/git/blob/master/gitk-git/gitk#L12602 – dylankb Apr 20 '20 at 06:02