aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2014-12-26 20:05:20 -0500
committerTeddy Wing2014-12-26 20:05:20 -0500
commitb481bb162ff1e0ffed71e4e8f8b20f2912a3a812 (patch)
tree321ef108e91c562f435aa940ae5ed3cc359168e1
parentd1e13040021c2f0418e00971842d814893a493e7 (diff)
downloadgit-checkout-history-b481bb162ff1e0ffed71e4e8f8b20f2912a3a812.tar.bz2
git-checkout-history: Print output from `git-checkout`
When `git-checkout` is run internally as part of `git-checkout-history`, print its output to the screen. This allows us to see the "Switched to branch 'example'" text when using `git-checkout-history` so we know for sure which branch we're actually on without having to `git status`.
-rw-r--r--git-checkout-history/main.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/git-checkout-history/main.go b/git-checkout-history/main.go
index 3b74e9e..cced21e 100644
--- a/git-checkout-history/main.go
+++ b/git-checkout-history/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "bytes"
"fmt"
"github.com/teddywing/git-checkout-history/utils"
"os"
@@ -17,10 +18,13 @@ func main() {
branchIndex, _ := strconv.Atoi(args[0])
cmd := exec.Command("git", "checkout", branches[branchIndex])
+ var out bytes.Buffer
+ cmd.Stderr = &out
err := cmd.Run()
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
}
+ fmt.Print(out.String())
utils.Store(branches[branchIndex])
} else {