Archive for the ‘Git’ Category

simple git, yarn, react, mongo project checklist

Wednesday, December 13th, 2017

mkdir foo && cd $_

git init

yarn add react

vi yarn.lock (if you’d like to see versions)

git add package.json yarn.lock

echo “/node_modules” >> .gitignore

git add .gitignore

touch README

git add README

git remote add origin git@github.som:credentials/foobar.git

git commit -m “Initial commit”

git push -u origin master

git checkout -b develop

git push -u origin develop

git checkout -b feature/foo develop

vi foo.js

git add foo.js

git commit -m “New foo file”

git rebase develop (if we believe changes have been made to origin develop, will pull those and then apply our commits)

git checkout develop

git merge feature/foo

git push

git checkout -b release/1.0 develop

git push -u origin release/1.0

git checkout -b hotfix/1.0 develop



example index connecting to mongo:


var MongoClient = require(‘mongodb’).MongoClient;

MongoClient.connect(process.env.MONGO_URI, function(err, db) {

    if (err) {

        console.log(‘Cannot connect to MongoDB!’, err);

    } else {

        console.log(‘Connected to MongoDB!’);



(put env vars in .env file)

vi .env

MONGO_URI = mongodb://localhost:27017/foo

yarn add mongodb

yarn add dotenv

(have mongo installed and started first!):

brew install mongodb —with-openssl

brew services start mongodb

Connected to MongoDB!”

Electron ReactJS PHP Oracle Service Cloud Multiple Interfaces Quick Deploy via Curl

Friday, December 1st, 2017


Electron application boilerplate based on ReactReduxReact RouterWebpackReact Transform HMR for rapid application development


  • Note: requires a node version >= 6 and an npm version >= 3.

First, clone the repo via git

Install dependencies with yarn

yarn install

:bulb: In order to remove boilerplate sample code, simply run yarn run cleanup. After this is run, the initial sample boilerplate code will be removed in order for a clean project for starting custom dev

$ yarn run dev

CSS Modules

This boilerplate out of the box is configured to use css-modules.

All .css file extensions will use css-modules unless it has .global.css.

If you need global styles, stylesheets with .global.css will not go through the css-modules loader. e.g.

If you want to import global css libraries (like bootstrap), you can just write the following code in .global.css:

@import "~bootstrap/dist/css/bootstrap.css";


To package apps for the local platform:

$ yarn run package

To package apps for all platforms:


$ yarn run package-all

To package apps with options:

$ yarn run package -- --[option]

Further commands

To run the application without packaging run

$ yarn run build
$ yarn start

To run End-to-End Test

$ yarn run build
$ yarn run test-e2e


See electron-builder CLI Usage

Module Structure

This boilerplate uses a two package.json structure.

  1. If the module is native to a platform or otherwise should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.
  2. If a module is imported by another module, include it in dependencies in ./package.json. See this ESLint rule.
  3. Otherwise, modules used for building, testing and debugging should be included in devDependencies in ./package.json.


Git frequently used

Tuesday, February 24th, 2015

// reset local branch to origin’s state

git checkout {branch}

git reset –hard origin/{branch}

// checkout new branch from origin

git checkout –track origin/{branch}

// merge

git merge {{branch}}

// stash when you need to keep changes but aren’t ready to commit them, say to switch branches or pull new work from team members into your unfinished state

git stash

git stash list

git stash apply {stashName}

// get git remote url

git config –get remote.origin.url
git remote show origin

// create a local branch and switch to it

git checkout -b {name the new branch}

edit, add, commit, push

git push -u origin {new branch name}

// invalidate user so to force password reset

git config –global credential.helper store

// remove already added files/folder from git and add to ignore 

git rm -r –cached file-path

// did hard reset, clean, need it back!? It hasn’t been garbage collected yet, pfew

$ git reflog
1a75c1d… HEAD@{0}: reset –hard HEAD^: updating HEAD
f6e5064… HEAD@{1}: commit: added file2

$ git reset –hard f6e5064
HEAD is now at f6e5064… added file2

// commit everything including untracked

git commit -A

// delete folder from repo

git rm -r folder-name

// output all branches

git branch -a

// delete local branch

git branch branch-name -D

// delete remote branch, just add -r for remote flag

git branch -dr branch-name

// configure git global difftool & mergetool

git config –global diff.tool bc3
git config –global merge.tool bc3
git config –global mergetool.bc3.trustExitCode true

// remove folder from git but don’t delete it

git rm -r –cached myFolder

GIT_TRACE=1 GIT_SSH_COMMAND=”ssh -vvv” git push

Rails Git Heroku Terminal command notes

Wednesday, January 19th, 2011

first cd to the project directory:

git init

git add .

git commit master

heroku create “NewApplicationName”

git push heroku master

heroku rake db:schema:load

rake db:schema:dump (handy to dump local db if you’ve been modifying it w/o migrations…)

heroku rake db:migrate