google / git-appraise

Distributed code review system for Git repos
Apache License 2.0
5.12k stars 145 forks source link

Add instructions for setting up the Git alias for Windows #77

Closed TomasHubelbauer closed 6 years ago

TomasHubelbauer commented 6 years ago

I used git config --global alias.appraise "%GOPATH%/bin/git-appraise.exe" to set up the Git alias. I verified the git-appraise.exe file exists.

Invoking it manually makes it say it needs to run within a context of a Git repository.

Running git appraise request gives me Expansion of alias 'appraise' failed; 'C:/Users/Tom/go/bin/git-appraise.exe' is not a git command. What I am doing differently from people who did get this run on Windows? Going through closed issues at least one person managed to. @linquize?

I am using Windows Command Prompt. I am willing to use PowerShell or WSL but not MSYS. Is that going to be a problem for me?

neil-greenwood commented 6 years ago

You need a leading exclamation point to run external executables as part of an alias configuration.

neil-greenwood commented 6 years ago
alias.*
       Command aliases for the git(1) command wrapper - e.g. after defining "alias.last = cat-file commit HEAD", the invocation "git last"
       is equivalent to "git cat-file commit HEAD". To avoid confusion and troubles with script usage, aliases that hide existing Git
       commands are ignored. Arguments are split by spaces, the usual shell quoting and escaping is supported. A quote pair or a backslash
       can be used to quote them.

       If the alias expansion is prefixed with an exclamation point, it will be treated as a shell command. For example, defining
       "alias.new = !gitk --all --not ORIG_HEAD", the invocation "git new" is equivalent to running the shell command "gitk --all --not
       ORIG_HEAD". Note that shell commands will be executed from the top-level directory of a repository, which may not necessarily be the
       current directory.  GIT_PREFIX is set as returned by running git rev-parse --show-prefix from the original current directory. See
       git-rev-parse(1).
TomasHubelbauer commented 6 years ago

I see!

In the readme it says: git config --global alias.appraise '!'"${GOPATH}/bin/git-appraise"

I was tweaking this and as a part of that also tried: git config --global alias.appraise '!'"%GOPATH%/bin/git-appraise.exe" which does have the exclamation point but within the '' which I am not sure does what on Unix, but when changing that to:

git config --global alias.appraise "!%GOPATH%/bin/git-appraise.exe"

...it now works! Thanks.