aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2014-12-26 19:30:53 -0500
committerTeddy Wing2014-12-26 19:33:07 -0500
commit4148c1408564d2353a43d78dcc9aab0d480a38fd (patch)
tree65c986b6a64c7e16ea211b80810b671816656192
parentd77af4ce1538f9da5e51e3ecb15a24bbe90358e5 (diff)
downloadgit-checkout-history-4148c1408564d2353a43d78dcc9aab0d480a38fd.tar.bz2
git-checkout-store: Take arbitrary arguments
Allow arbitrary arguments to be inputted. This allows us to take flags and pass them on directly to `git-checkout`. We can now for example do git checkout-store -b some-new-branch and the command will work the same way as `git-checkout` with the added benefit of storing the branch in history.
-rw-r--r--git-checkout-store/main.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/git-checkout-store/main.go b/git-checkout-store/main.go
index 3fd82f3..085a4a0 100644
--- a/git-checkout-store/main.go
+++ b/git-checkout-store/main.go
@@ -12,9 +12,9 @@ func main() {
args := os.Args[1:]
if len(args) > 0 {
- utils.Store(args[0])
+ utils.Store(args[len(args) - 1])
- cmd := exec.Command("git", "checkout", args[0])
+ cmd := exec.Command("git", append([]string{"checkout"}, args...)...)
var out bytes.Buffer
cmd.Stderr = &out
err := cmd.Run()