A Portfolio and blog for Mustafa Kurtuldu

Was getting a bit annoyed at having to to write the same thing over and over again when trying to commit soemthign simple to git. 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.