A quick git bash script for you guys!
If you are like me and value simplicity and hate remembering stuff then this simple git bash script to commit and push your code to both local and remote git repositories is for you. I am using GitLab to host my remote repository.
Setting Up a Local git Repository and Pushing it to a Remote Repository
git init git add -A git commit -m "first commit" git remote add origin git@***your repository*** git push -u origin master
Now, simply save the below script in a file called commit.bash, making sure to change the first line to point to where your code lives.
#!/bin/bash cd /Users/alex/Documents/DEV git add -A if [ $# -eq 0 ] then git commit -m "nothing to see here" else git commit -m "$*" fi git status git push origin master
Then add executable permissions the saved file:
chmod +x commit.bash
Then hack away with your code. When you are ready to commit and push your code to git simply run your git bash script!
./commit.bash cool stuff
Happy coding!