aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md6
-rw-r--r--git-completion.bash.patch18
-rw-r--r--utils/utils.go2
3 files changed, 25 insertions, 1 deletions
diff --git a/README.md b/README.md
index bca61f8..d09ff8c 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,12 @@ Run these commands to build `git-checkout-history` and `git-checkout-store`:
$ go install github.com/teddywing/git-checkout-history/git-checkout-store
+## Shell Completion
+If you use bash or zsh completion for git, a patch file is included to add this functionality for `git-checkout-store`. The patch enables `checkout-store` to have the same completion functionality as `checkout`. It can be applied as usual:
+
+ $ patch path/to/git-completion.bash < path/to/git-completion.bash.patch
+
+
## Known Issues
* Currently, branch history is stored globally. When used in multiple repositories, all branches go to the same list. There should be a different branch storage list for each repository.
* History never gets cleared. Not sure if this is actually an issue, but personally I don't really care about branch history from before the current day.
diff --git a/git-completion.bash.patch b/git-completion.bash.patch
new file mode 100644
index 0000000..cce309c
--- /dev/null
+++ b/git-completion.bash.patch
@@ -0,0 +1,18 @@
+--- git-completion.bash.orig 2015-01-06 16:19:15.000000000 -0500
++++ git-completion.bash 2015-01-06 16:35:14.000000000 -0500
+@@ -940,10 +940,15 @@
+ __gitcomp_nl "$(__git_refs '' $track)"
+ ;;
+ esac
+ }
+
++_git_checkout_store ()
++{
++ _git_checkout
++}
++
+ _git_cherry ()
+ {
+ __gitcomp "$(__git_refs)"
+ }
+
diff --git a/utils/utils.go b/utils/utils.go
index 82da017..1f8ebb7 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -107,7 +107,7 @@ func Branches() []string {
file_path := getHomeDir() + "/" + history_file
data, err := ioutil.ReadFile(file_path)
if err != nil {
- log.Fatal(err)
+ log.Fatal("ERROR: No checkout history file. Run `checkout-store` to create it.")
}
err = yaml.Unmarshal(data, &branchList)