Skip to content

Instantly share code, notes, and snippets.

@v01pe
Created April 14, 2015 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v01pe/9dfca3cef90b8bb8608b to your computer and use it in GitHub Desktop.
Save v01pe/9dfca3cef90b8bb8608b to your computer and use it in GitHub Desktop.
Using git on the command line, but tired of typing `git` in front of every command? Use this little script.
#!/bin/bash
lastcmd=""
while [ true ]; do
read -r -e -p "> git " gitcmd
if [ "$gitcmd" != "" ] && [ "$gitcmd" != "$lastcmd" ]; then
lastcmd=$gitcmd
history -s "$gitcmd"
fi
if [ "$gitcmd" == "exit" ]; then
break
elif [ "$gitcmd" == "history" ]; then
history
elif [ "$gitcmd" != "" ]; then
eval git $gitcmd
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment