DEV Community

Collins Mutai
Collins Mutai

Posted on • Edited on

How to automate git commits

Create a folder with a file name "push.bat" and save the file type as All files, then add the following code.

git add .
git commit -m %1
git push

Enter fullscreen mode Exit fullscreen mode

Next configure the path by opening Environment Variables on your machine then edit path, under path section, add the path to the "push.bat" file and click ok to exit.
Now we can push changes to a remote repository using a single line of code like so.

push "commit message"
Enter fullscreen mode Exit fullscreen mode

That's it guys, this was a time saver for me because I'm currently taking a course on Bootstrap 4 and I have to regularly do commits. Happy coding 🤓

Credit [https://medium.com/@cibiaananth/how-to-add-commit-and-push-to-git-using-one-command-on-windows-25d756f444b7]

Top comments (0)