Makefile git add commit push github All in One command

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.

$ git add .

Step 2:

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

$ git commit -m “Add existing file”

Step 3:

Push the changes in your local repository to GitHub.

$ git push origin branch-name

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 postYou see makefile among the others files

Step 2:

put these in that makefile:

git: git add . git commit -m “$m” git push -u origin master

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

Image for post

Step 3:

In terminal do this:

make git m=”your message”

and you will see such message in terminal:

Image for post

That?s it!

Thank you for reading! If you enjoyed this article:

Clap it ! Share it! Follow Me in Medium!

Panjeh ? Medium

Read writing from Panjeh on Medium. Physicists PhD, Self-taught web developer #Learning, #laravelphp #Vuejs. Every day?

Also I?d like to hear your opinion on this article. If you have any doubt, question or suggestion please leave a comment below.

Have a very wonderful day!

Previous Stories You will Love:

Free for Students online git repository Github

remove last commit local undo the most recent commit Git github repository

The solution is to first remove the last commit in local and then force push to Github

git error: invalid object Error building trees

Today I faced this error:

Git status fatal: bad object HEAD

First of all, note that using git itself is not enough to keep data safe. You still need to back it up and have a?


No Responses

Write a response