Makefile git add commit push github All in One command

As a remember, the traditional way of adding a file to a repository using the command line is summarized into 3 steps as follow:

Step 1:

  1. Open the terminal.
  2. Change the current working directory to your local repository.
  3. Stage the file for commit to your local repository by the following command.

Step 2:

Commit the file that you’ve staged in your local repository.

Step 3:

Push the changes in your local repository to GitHub.

How to run ALL in one command from within a Makefile?

put all git add, git commit, git push command in a makefile as follow:

Step 1:

You need just to make a “makefile” in your project directory. Attention: makefile does not have any extension. Just “makefile” that’s it.

Image for post
Image for post
You see makefile among the others files

Step 2:

put these in that makefile:

Attention: Each line after the first line I mean (git :) is starting with a tab and not space. Something Like this:

Image for post
Image for post

Step 3:

In terminal do this:

and you will see such message in terminal:

Image for post
Image for post

That’s it!

Written by

Web geek, Self-taught full-stack web developer, Learning Python, Laravel, Vuejs, UX/UI design, Nuclear Physicist PhD

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store