16/10/2017 / Samuel

If you frequently work with Git and use git add, commit & push, here is a snippet that will save your time. The steps below apply to a Unix environment : Linux or MacOs.
 

Step 1

Edit ~/.bash_profile by running the following command in your terminal.

vi ~/.bash_profile

 

Step 2

Add the gitl (for gitlazy) command as follows.
 

function gitl() {
	git add .
	git commit -m "$*"
	git push
}

 

Step 3

For the new function to be working, you need to refresh with the command below:

source ~/.bash_profile

 

Step 4

Now, whenever you need it you can use

gitl my initial commit

instead of typing

git add . 
git commit -m "my initial commit" 
git push

 

Test it, leave a comment and share!

Facebook Comments