Create global .gitignore for user settings

ignored

When it comes to ignoring files in a git repository I do something I think many others have done.  I’ve added user level settings files to my .gitignore because I don’t want them included in my git repository.  You know, the files created by an IDE, operating system, or other applications.  Such as ‘.project’ created by Zend Studio or ‘.idea’ created by PHPStorm, and there are many others.

While it may be acceptable to add them to the .gitignore file in a private repo, should they be ignored in a publicly shared repository?  To answer this let me explain that I believe in “freedom”, and think everyone is entitled to do what they want, as long as it doesn’t hinder someone else’s freedom.  This is important when it comes to code.  Therefore, these files should NOT be ignored in the .gitignore of a public repo because someone creating a clone of the repo may desire to do something different.  So marking these files to be ignored, or not, should totally be a personal decision made by the user.

However, there is a way to have our cake, and eat it too.  We can inform our local instance of git to have a system global .gitignore file.  Therefore while the individual repository has a clean .gitignore file, with only references specific to the project, we can still have our user level ignores in place.  Here is how to do it.

From command line issue the following command: (command is non-Windows because of the file location, I’m not sure what it would be on a Windows machine, so perhaps someone can comment with a Windows friendly command)

$ git config --global core.excludesfile ~/.gitignore_global

This command creates a global setting in our systems git configuration informing git of an excludes file containing additional files to ignore globally.  The file name will be called ‘.gitignore_global’ and will be located in the users home directory.

Adding this –global config setting to git does not create the file for us, so we will still need to create this file in the location we specified. (The home directory in this case.)  Here is what mine looks like:

.idea
.buildpath
.project
.settings
.vagrant
.DS_Store
nbproject
.thumbs

Meanwhile my project level .gitignore might look like:

/vendor
local.config.php

For more on this topic, and perhaps a better explanation, please see https://help.github.com/articles/ignoring-files.

Schedule for a productive day

Thanks to a friends tweet I found a handy post on “The Week” which highlighted schedules of successful people and productivity tips around optimized daily appointments.  Much of it rang true with me, so to prevent me from losing sight of it I decided to reiterate it here.

  • Early morning

    • Wake early, to get things going prior to insanity starting. Before goals have competition.
    • Many stick to a morning ritual.
    • Set concrete goals for the day.
  • First things

    • Tackle important things early/first.  The first couple hours of the day are our most productive, don’t waste them on email and/or meetings.
    • Escape to a quiet place, distractions make us stupid.  Avoid “drive-by” meetings, they will leech your most productive time.
    • We’re more disciplined in the morning, so take advantage of it.
    • Energy is high – do creative and challenging work.
    • Having troubles working on what is needed?  Get in earlier.
  • Slowdown blahs = regroup time

    • Take a break, get a snack, take a power nap.  Often a power nap is like a reset button.
    • Re-enact the morning ritual to get going again.
    • Review goals of the day.
    • Focus on successes from earlier in the day.
  • Afternoon lull

    • Energy is low – do busy work.
    • Best time for meetings.
    • Good time for a run. (personal note about me)
    • Distractions can be a benefit when we can’t focus.
  • Evening

    • Before dinner write down goals for following day.
    • Do some relaxing activities.
      • TV, video games, eating are not relaxing. #mindtricks
      • Instead meet with friends, talk, play with hobbies. #truth
    • Get to bed at a good time, lack of sleep makes us stupid.