As a remember, the traditional way of adding a file to a repository using the command line is summarized into 3 steps as follow:
- Open the terminal.
- Change the current working directory to your local repository.
- Stage the file for commit to your local repository by the following command.
$ git add .
Commit the file that you?ve staged in your local repository.
$ git commit -m “Add existing file”
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:
You need just to make a ?makefile? in your project directory. Attention: makefile does not have any extension. Just ?makefile? that?s it.
You see makefile among the others files
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:
In terminal do this:
make git m=”your message”
and you will see such message in terminal:
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!