diff options
author | Teddy Wing | 2014-12-06 11:45:30 -0500 |
---|---|---|
committer | Teddy Wing | 2014-12-06 11:45:30 -0500 |
commit | 5cf065714b672445ff4f28649f8cb2ea12c2f17c (patch) | |
tree | 01ded36b78a3191bdc8d71e903ac2085ecb61fb8 /git-checkout-store | |
parent | c32a3d476a5c5a45fc9d9af45b7393d6f9cc1db0 (diff) | |
download | git-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.go | 10 |
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()) + } + } } |