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:
- 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 .
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.
You 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:
Step 3:
In terminal do this:
make git m=”your message”
and you will see such message in terminal:
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?
medium.com
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!