Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lovejavaee/6f398dbb2d3d7f1d4b38584337e86954 to your computer and use it in GitHub Desktop.
Save lovejavaee/6f398dbb2d3d7f1d4b38584337e86954 to your computer and use it in GitHub Desktop.
Having to write
git pull origin branch_name
followed by
git add all -A
then
git commit -m "blaaah blaah"
was getting a bit annoying so I figured out how to combine these into a single command as most of the commits I make are quite straight forward.
First thing you need to do is find your .bash_profile which should be in your home/user directory (I’m using a MAC here, no idea where it would be for other OS’s).
Second, make sure you take a copy of it in case something screws up.
Then open it up and write this function in there.
gitty() {
git pull origin : ;
git add . ;
git commit -m "$1";
git push ;
}
Save then file, quit and relaunch terminal. Now whenever you make a change to your git repo and want to commit something simply type
gitty "this is the commit message"
No more annoyance. What this function does is combine multiple commands at the same time. Simples.
PS – I call this gitty, but you could name it what ever you want.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment