aboutsummaryrefslogtreecommitdiffstats
path: root/git-checkout-store
diff options
context:
space:
mode:
authorTeddy Wing2014-12-06 11:45:30 -0500
committerTeddy Wing2014-12-06 11:45:30 -0500
commit5cf065714b672445ff4f28649f8cb2ea12c2f17c (patch)
tree01ded36b78a3191bdc8d71e903ac2085ecb61fb8 /git-checkout-store
parentc32a3d476a5c5a45fc9d9af45b7393d6f9cc1db0 (diff)
downloadgit-checkout-history-5cf065714b672445ff4f28649f8cb2ea12c2f17c.tar.bz2
git-checkout-store: Run `git checkout` with argument
If an argument is passed in, run `git checkout` using that first argument to the program. Currently doesn't accept flags from git-checkout or send output from git-checkout. Ideally both of those would be supported.
Diffstat (limited to 'git-checkout-store')
-rw-r--r--git-checkout-store/main.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/git-checkout-store/main.go b/git-checkout-store/main.go
index d02f8ad..359c4db 100644
--- a/git-checkout-store/main.go
+++ b/git-checkout-store/main.go
@@ -3,11 +3,19 @@ package main
import (
"os"
+ "os/exec"
"fmt"
)
func main() {
args := os.Args[1:]
- fmt.Println(args)
+
+ if len(args) > 0 {
+ cmd := exec.Command("git", "checkout", args[0])
+ err := cmd.Run()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, err.Error())
+ }
+ }
}