Github revisited


Have you ever had that feeling when you are learning something, and then find out you were doing it wrong, or at least not in the best way? Yeah…

I know I was not using Github to anywhere close to its capabilities, and I there are still uses that still need to be uncovered, but a new road has been taken!

Gitignore is now my best file friend. .gitignore will stop files from being synced to the project. The way I used this feature is I created a demo project from a tutorial. The tutorial is an example of how to use an API. So instead of giving my API key to the world, I created a file that holds a variable, which holds the key, and reference the variable from the project. That file is listed in the .gitignore, and TADA! I still have an app to show, and the public at large can sign up for the service if they really want to try out my demo.

This thought has been recurring a lot -> after learning of new utilities, it just seems so obvious. Why wouldn’t you have a thingy that does exactly that? But in reality, its not. You don’t know what you don’t know until you discover you didn’t know it. This is the nature of life and programming.

So, one thing I would like to emphasize is the order in which things have to happen…

1) Create your project

2) Create your .gitignore file. For Mac users, you may do this by going to project folder and typing   touch.gitignore  You can open this file with your favorite editor.

3) Add the path and name of the file you wish to exclude. The path will be relative to the project root folder.

4) Save the file and sync with your project.

5) Create the file you wish to have excluded. Sync with your project.

You did read correctly, the file to be excluded must be created AFTER it is listed in .gitignore. There are ways of recursively adding, and excluding files after creation, but that is beyond the scope of me patting myself on the back for figuring out the basics!