Skip to content

Instantly share code, notes, and snippets.

@jpgls
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpgls/4068b808198ab4f8e508 to your computer and use it in GitHub Desktop.
Save jpgls/4068b808198ab4f8e508 to your computer and use it in GitHub Desktop.
Command Line Notes

Command Line Notes

Trying to start a collection of the commands/workflows/etc. that I find when looking up how to accomplish something from the Command Line.

Git Commands


Discard Changes for a Specific Directory

#==== SYNTAX
git checkout [branch] -- [path/from/root/of/repo]

#==== EXAMPLE

Alexanders-MacBook-Air-4 ⏣ ~/Projects/personal
442 ◯ : git checkout master -- src/js

Shell Commands


Create a Symbolic Link

#==== SYNTAX
ln -s source_file [target_file]

#==== EXAMPLE

Alexanders-MacBook-Air-4 ⏣ ~/Projects/personal
442 ◯ : ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

Create and Navigate to Directory

For bonus points, use a variable for long names.

#==== SYNTAX
[VAR]='[name-of-folder-to-create]'
mkdir $[VAR] && cd $[VAR]

#==== EXAMPLE
Alexanders-MacBook-Air-4 ⏣ ~/Projects/personal
442 ◯ : NF='themes'

Alexanders-MacBook-Air-4 ⏣ ~/Projects/personal
443 ◯ : mkdir $NF && cd $NF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment