Git: add a remote repository

In case you need to work with more than one remote repositories, chances are you need to add one of them (origin comes as a default).

$ git remote add remote_name 

Choose the remote_name as you wish and grab the repo URL from github.

You may also be interested in Selecting remote repository on git or maybe if you need to rename your remote, you might want to read how to rename a remote repository

For a little more information, visit:



Git: Show history of a file

There are two main ways to show the history of a file using git (that is, listing all commits that changed a provided file).

The best one is:

$ git log --follow filename

It will list all commits that ever touched that file, including renames

$ git log -- path/to/file

…will also list all commits, but without resolving file renames.

You might also like git history log of a line, that lists all commits that ever touched a specific line


Change the author of a git commit

Issue this command to change the author of the very last commit message:

$ git commit --amend --author="John Doe <>"

To change the author of your config file:

$ git config --global "John Doe"
$ git config --global ""

For more commands, visit

For more git quick commands, go to


Change username on linux

To manage every aspect of the user database, you use the usermod tool.

To change username (it is probably best to do this without being logged in):

usermod -l newUsername oldUsername

This, however, does not rename the home folder.

To change home-folder, use

usermod -d /home/newHomeDir -m newUsername

after you changed the username.


Create patches with git format-patch

Git has a wonderful tool that allows you to create patches of the commits in the tree of your project: git format-patch.


 $ git format-patch [<options>] [<since> | <revision-range>]

More information can be seen via man page:

$ git format-patch -h


$ man git format-patch

For example:

$ git format-patch -N

This command generates one .patch file for each of the N commits on the top of your tree. Example:

$ git format-patch -1

Generates a .patch file for the commit on the top of your tree. Increase the number to get one file per commit (for the top 3 commits, use ‘-3’).

To apply the patch, use

$ git am [your-patch].patch


npm/yarn: live-server installation issue

Executive summary:


$ live-server
zsh: command not found: live-server SOLUTION: $ export PATH=$PATH:/home/user/.yarn/bin/


Today my attempt to install the live-server package in a Linux Mint Sylvia (Ubuntu Xenial) box using yarn failed. The installation went just fine, with just some info messages:

$ yarn global add live-server
yarn global v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["object-assign@latest"] is trying to unpack in the same destination "/home/dbkreling/.cache/yarn/v1/npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863" as pattern ["object-assign@^4.1.0","object-assign@^4"]. This could result in a non deterministic behavior, skipping.
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "live-server@1.2.0" with binaries:
- live-server
Done in 1.98s

Cool! And then..

$ live-server
zsh: command not found: live-server



Digging it further I found it (no pun intended) hidden in my home directory:

$ sudo find / -name "*live-server*"
[sudo] password for dbkreling:
find: ‘/run/user/1000/gvfs’: Permission denied

Looking at my PATH, I had no .yarn directory whatsoever, so this is what I got:


After adding ~/.yarn/bin to my $PATH I had no more problems  to run it:

$ export PATH =$PATH:$HOME/.yarn/bin