package main

import (
	"bytes"
	"fmt"
	"github.com/teddywing/git-checkout-history/utils"
	"os"
	"os/exec"
)

func main() {
	args := os.Args[1:]
	
	if len(args) > 0 {
		utils.Store(args[0])
		
		cmd := exec.Command("git", "checkout", args[0])
		var out bytes.Buffer
		cmd.Stderr = &out
		err := cmd.Run()
		if err != nil {
			fmt.Fprintf(os.Stderr, err.Error())
		}
		fmt.Println(out.String())
	}
}

package main

import (
	"bytes"
	"fmt"
	"github.com/teddywing/git-checkout-history/utils"
	"os"
	"os/exec"
)

func main() {
	args := os.Args[1:]
	
	if len(args) > 0 {
		utils.Store(args[0])
		
		cmd := exec.Command("git", "checkout", args[0])
		var out bytes.Buffer
		cmd.Stdout = &out
		err := cmd.Run()
		if err != nil {
			fmt.Fprintf(os.Stderr, err.Error())
		}
		fmt.Println(out.String())
	}
}

--- 
+++ 
@@ -16,7 +16,7 @@
 		
 		cmd := exec.Command("git", "checkout", args[0])
 		var out bytes.Buffer
-		cmd.Stdout = &out
+		cmd.Stderr = &out
 		err := cmd.Run()
 		if err != nil {
 			fmt.Fprintf(os.Stderr, err.Error())
git-checkout-store: Print `git checkout` stderr output

Turns out `git checkout` prints to STDERR instead of STDOUT. Grab the
STDERR output and print that to the screen so we can see the "Switched
to branch 'x'" text when using `git checkout-store`.
