Commands & Notes git add <FILENAME> to add a single file or git add . to add all files to staging git commit -m “MESSAGE” to commit in one step without entering editor mode Git history commands: git log git log –pretty=oneline git log –pretty=oneline –max-count=2 git log –pretty=oneline –since=’5 minutes ago’ git log –pretty=oneline […]
pwd = Print Working Directory hostname = Display’s your computer’s network name mkdir DIRECTORY = Make directory cd = Change directory ls = List directory contents rmdir DIRECTORY = Remove directory pushd PATH = Saves current directory in memory, and takes you to the new path popd = Switches back to previous directory cp FILEPATH-FROM […]
Create new repo on GitHub Create folders and files locally and use Terminal to push repo up… git init git remote add origin git@github.com:USER/REPO.git git add . git commit git push origin
git checkout master /* switch to master branch */ git reset —hard /* clears local to match origin */ git branch -a /* lists branches */ git checkout BRANCH /* checks out BRANCH branch */
git checkout theirs [file]
Remove a file from the repo via your branch and commit git rm [file]
ctrl + u erases entire line ctrl + c quits a binary execution and gets you back to the prompt
$PATH is a variable used by Terminal for scanning through a colon-delineated list of paths to binaries. For example, when typing ls, sudo, npm, etc., Terminal searches through the paths for a match to the alias; when it finds a match it executes that binary. Resources The PATH Variable
Install Node.js Open Terminal and install PhoneGap followed by Cordova… $ sudo npm install -g phonegap $ sudo npm install -g cordova Install SDK’s for targeted environments Create a New Project In Terminal, navigate to where you want to create the new project directory, and then run Cordova’s create command, passing in 1) The directory name […]
git diff develop:sports/views.py feature/sports_team_fronts_links:sports/views.py
git reset –hard HEAD~ Fixes the annoying “Your branch is ahead by blahblahblah commits.”
To get back to a specific commit type… git reset –hard fe8ef61119454071e87095e4ff8b24c6833cb0c6 …where “fe8ef61119454071e87095e4ff8b24c6833cb0c6” represents the commit’s SHA number.
Install the Grunt command line tool (requires node.js installed on your machine)… sudo npm install grunt-cli -g Create package.json in root of project (list of Grunt plugin dependencies) npm install (install the dependencies) Create Gruntfile.js in root of project (configuration) Basically, you need three different functions to work with Grunt: grunt.initConfig, grunt.loadNpmTasks, and grunt.registerTask Resources Grunt: A Build Tool […]
Creating a new alias (shortcut) in Terminal… Edit profile vim ~/.bash_profile Create alias alias mynewalias=’does this; and this’ Control+o (or esc) … :wq Save profile source ~/.bash_profile My list of aliases… alias aliasnew=’vim ~/.bash_profile’ alias aliassave=’source ~/.bash_profile’ alias an=’vim ~/.bashrc’ alias as=’source ~/.bashrc’ alias checkcss=’./scripts/verify_css.sh’ alias clear=’pip install -i http://23.20.194.155/simple -r setup/requirements.txt; source virtualenvwrapper.sh’ alias […]