golang exec.Command在其他文件夹中

I have a problem with exec.Command with .Dir assigned. When I run command from the app I get an error. but if I run it from the shell the same command is working fine.

command := exec.Command("git", "rev-parse", "--verify", "tags/v1.0.0^{commit}")
command.Dir = "sub/subdir"
out, err := command.CombinedOutput()
fmt.Printf("Executed command [%s] %s
ErrorCode = %s
Output = %s
", command.Dir, command.Args, err, out)

The output:

Executed command [sub/subdir] [git rev-parse --verify tags/v1.0.0^{commit}]
ErrorCode = exit status 128 
Output = fatal: Needed a single revision

Shell command:

$ (cd sub/subdir; git rev-parse --verify tags/v1.0.0^{commit})
c1f3b8707ac001dab875781def3c729e3ed6de2c

What did I do wrong?

Use an absolute path. Check out filepath.Abs