Tutorial by Examples

HEAD is a special ref. It always points to the current object. You can see where it's currently pointing by checking the .git/HEAD file. Normally, HEAD points to another ref: $cat .git/HEAD ref: refs/heads/mainline But it can also point directly to an object: $ cat .git/HEAD 4bb6f98a223abc...
A ref is essentially a pointer. It's a name that points to an object. For example, "master" --> 1a410e... They are stored in `.git/refs/heads/ in plain text files. $ cat .git/refs/heads/mainline 4bb6f98a223abc9345a0cef9200562333 This is commonly what are called branches. Howeve...
A commit is probably the object type most familiar to git users, as it's what they are used to creating with the git commit commands. However, the commit does not directly contain any changed files or data. Rather, it contains mostly metadata and pointers to other objects which contain the actual c...
A tree basically represents a folder in a traditional filesystem: nested containers for files or other folders. A tree contains: 0 or more blob objects 0 or more tree objects Just as you can use ls or dir to list the contents of a folder, you can list the contents of a tree object. $ git ca...
A blob contains arbitrary binary file contents. Commonly, it will be raw text such as source code or a blog article. But it could just as easily be the bytes of a PNG file or anything else. If you have the hash of a blob, you can look at it's contents. $ git cat-file -p d429810 package com.exampl...
The git commit command does a few things: Create blobs and trees to represent your project directory - stored in .git/objects Creates a new commit object with your author information, commit message, and the root tree from step 1 - also stored in .git/objects Updates the HEAD ref in .git/HEAD t...
When you run git checkout on a commit (specified by hash or ref) you're telling git to make your working directory look like how it did when the snapshot was taken. Update the files in the working directory to match the tree inside the commit Update HEAD to point to the specified hash or ref ...
Running git reset --hard moves refs to the specified hash/ref. Moving MyBranch to b8dc53: $ git checkout MyBranch # moves HEAD to MyBranch $ git reset --hard b8dc53 # makes MyBranch point to b8dc53
Running git checkout -b <refname> will create a new ref that points to the current commit. $ cat .git/head 1f324a $ git checkout -b TestBranch $ cat .git/refs/heads/TestBranch 1f324a
The non-block do construct looks like integer i do 100, i=1, 5 100 print *, i That is, where the labelled termination statement is not a continue statement. There are various restrictions on the statement that can be used as the termination statement and the whole thing is generally v...
MySQL's DELETE statement can use the JOIN construct, allowing also to specify which tables to delete from. This is useful to avoid nested queries. Given the schema: create table people ( id int primary key, name varchar(100) not null, gender char(1) not null ); insert people (id,na...
The reduce function can be used to sum the elements in a list. (reduce '+ '(1 2 3 4)) ;;=> 10 By default, reduce performs a left-associative reduction, meaning that the sum 10 is computed as (+ (+ (+ 1 2) 3) 4) The first two elements are summed first, and then that result (3) is added to...
Common Lisp already has a reverse function, but if it didn't, then it could be implemented easily using reduce. Given a list like (1 2 3) === (cons 1 (cons 2 (cons 3 '()))) the reversed list is (cons 3 (cons 2 (cons 1 '()))) === (3 2 1) That may not be an obvious use of reduce, but if we ha...
You can use curl: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash Or you can use wget: wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
To verify that nvm has been installed, do: command -v nvm which should output 'nvm' if the installation was successful.
Listing available remote versions for installation nvm ls-remote Installing a remote version nvm install <version> For example nvm install 0.10.13
To list available local versions of node through NVM: nvm ls For example, if nvm ls returns: $ nvm ls v4.3.0 v5.5.0 You can switch to v5.5.0 with: nvm use v5.5.0
The prop-types package allows you to add runtime type checking to your component that ensures the types of the props passed to the component are correct. For instance, if you don't pass a name or isYummy prop to the component below it will throw an error in development mode. In production mode the p...
Three methods are provided that offer the ability to strip leading and trailing characters from a string: str.strip, str.rstrip and str.lstrip. All three methods have the same signature and all three return a new string object with unwanted characters removed. str.strip([chars]) str.strip acts o...
To connect using java.sql.DriverManager you need a JDBC url to connect to your database. JDBC urls are database specific, but they are all of the form jdbc:<subprotocol>:<subname> Where <subprotocol> identifies the driver or database (for example postgresql, mysql, firebirdsql,...

Page 331 of 1336