Show commit statistics
$ git log --stat
Display changes made to a file
$ git log --patch
$ git log -p
Ignore whitespace when comparing lines.
$ -w
Display most recent commit
$ git show SHA
Search commits by commit message
git log --all --grep='Convert social links from text to images'
Changes that have been made but haven't been committed, yet
$ git diff
Tag a commit
$ git tag -a beta
Delete a tag
$ git tag -d beta
Change Last Commit
will let you provide a new commit message
$ git commit --amend
- make changes to the necessary files
- save all of the files that were modified
- use
git add
to stage all of the modified files - run git
commit --amend
to update the most-recent commit instead of creating a new one
Undo Changes into a New Commit
$ git revert <SHA-of-commit-to-revert>
Show Detailed Log
$ git log --oneline --graph --decorate --all
Sync Remote Repo with Local
pushes changes to a remote
$ git push
Sync Local Repo with Remote
pulls changes from a remote & merges into a local master
$ git pull
If there are commits on the repository that you don't have but there are also commits on the local repository that the remote one doesn't have either, then use
git fetch
to prevent an automatic merge of the local branch with the tracking one.
Check remotes
git remote -v
The shell is a program that takes commands from the keyboard and gives them to the operating system to perform. In the old days, it was the only user interface available on a Unix-like system such as Linux. On most Linux systems a program called bash
(which stands for Bourne Again SHell, an enhanced version of the original Unix shell program, sh, written by Steve Bourne) acts as the shell program.
List commands with letters "spell"
$ man -k spell
Find files
first argument is where to start search
$ find ~ -name "poem*"
Interesting!
cat
is the Linux command which means 'concatenation'.In fact, many people use
cat
, rather thanmore
, to display the contents of a file. However, we do not recommend usingcat
in this way, since it is not nearly as useful asmore
.
Send command output to a file
To send the output from a command such as
cat
to a file, use either>
or>>
.
>
- overwirtes file content>>
- appends to file content
Standard Input
Many commands can accept input from a facility called standard input. By default, standard input gets its contents from the keyboard, but like standard output, it can be redirected. To redirect standard input from a file instead of the keyboard, the "<" character is used like this:
$ sort < file_list.txt > sorted_file_list.txt
Print two copies of a document to the default printer
$ lpr -# 2 filename
Check the print queue
$ lpq -P <printerName>
Show Disk Space in Home Directory
$ df ~
List All Running Processes
ps aux
Kill Process Immediately
kill -9 PID
Display Path to a Binary to Be Executed with a Command
type code
Honestly, I've been struggling to wrap my mind around streams, and I still am. I refuse to say I know something unless I understand all ins and outs of how something works internally.
For example, we had to use the npm
through2
package, whereas I tried to solve the problems without it, alas, to no avail. I would really appreciate some more practical tasks to understand/refine my understanding of how streams work.
I also had a hard time with a couple of tasks from the Functional JS Workshop, but I enjoyed solving them. My favorite ones include
currying
,trampoline
, as well as bindingArray.prototype.slice
toFunction.prototype.call.
in order to create a function which acts likeslice
.