Saturday, February 14, 2015

Git bash for dummies

I've been using windows for too long. Windows is a nice OS, especially Windows 10. So after using an OS that relies mostly on GUIs, you tend to get a little spoiled. Clicking seems natural after a while and you get used to it very quickly. But most GUIs while allowing you that comfort, tend to take away some of the power away from you. This is where bash based applications excel.

I have recently been using the Github app, but came into many problems which led to switch to the bash version. If you are starting a new project on Github and decide to not rather use the Github app, then the git bash app is the best way to go. This tutorial will explain how to set up a project from scratch using the git bash app in Mac OS X:

Git not yet installed

If you don't already have git installed on your mac I suggest the following:
  1. Open a terminal
  2. Install homebrew using the following command: ruby -e "$(curl -fsSL"
  3. Install git using the following command: brew install git

Git already installed

If you already have git installed on your mac then do the following:
  1. Go to your Github page and create a new repository
  2. Open a terminal
  3. Go to the folder where you want your repository to be found
  4. Clone your newly created repository with the following command: git clone, where _user_ is your Github username and _repository_  is the name of the new repository you just created. This command will create a new directory in your current path as specified by
  5. Now comes the tricky part: copy all the code that you want to get uploaded into Github into your newly created folder
  6. Add all (new) files to git with the following command: git add .
  7. Commit all your changes with the following command: git commit -m "_message_", where _message_ is the (first) commit message (e.g. "Initial commit")
  8. And finally, push all the changes into Github with the following command: git push _user_ is your Github username and _repository_ is the name of the new repository
So there you go. It's a lot more work than just clicking some buttons, but it sure does gives you more satisfaction once everything works out like intended. 


Post a Comment