On Github FEWDMaterials / gitCheatSheet
(Arrow or scroll down to see)
Shows current working directory
Shows current folders/files within current working directory
Shows all current folders / files in list form
Changes the present working directory to the one specified.
Takes you back "home" no matter where you are, this is usually the folder that contains your Documents, Desktop, etc
Changes directory to one above your present working directory. Similarly, ../../ goes up two directories above present working directory, etc
Creates a directory.
Removes a FOLDER and everything inside of it (including other folders).
Creates an empty file (you can edit it in Sublime Text)
Removes a file called filename.js. Note this must be in your present working directory. Also note that we do not need -rf arguments here
Git will keep track of the files as you code. Remember that one time in college when you wrote the perfect sentence?
But then fate cruelly killed the battery on your laptop before you had a chance to save?
And that sentence -- in its perfection -- was lost to both you and mankind for all eternity? (Because Cmd+Z cannot help you once the text editor is closed). (But also the world just wasn't ready for such literary genius).
Well, if you had git commited + pushed your paper with that sentence immediately after crafting it -- then went on to write a completely different paper on that same file and burning your computer in a large bonfire...
...you would still have that sentence of yours!
Perfectly intact.
Along with whatever your wrote before it.
Even though the computer you wrote it on is now burned to a crisp and that file now hosts an elaborate list of movies you want to watch before turning 25...
This will start tracking all the files that change in your present working directory
This is your best friend, it will tell you what start each file in your directory is in
You git add files that you want to be "frozen" into the current git revision. Typically, a git revision will have several files earmarked to be "frozen" (because a website feature is typically some html changed, some css changes, some javascript changes all at once).
(-- make it something succint that describes your changes)
Once all the files that have changed are earmarked to be frozen, you run a git commit with a message. This will create a snapshot of your code AS IT IS NOW so you can go back to it later if you ever need to.
First, create an account on GitHub. (Or, sign in if you already have one).
On the top right hand bar, there is a '+' button. Click that and create a new repository.
...into your terminal window.
You should be solid. Every few commits, do yourself a favor and push to github. After the first push, all you need to do is:
(the -u origin master is no longer needed).
Laugh all the way to the bank.