How to squash Git commits already pushed to repository

If you have several commits and want to merge them (squash) into one, you can do that by squashing them, even if you already pushed them to your remote repository.

To do that, first you need to list your commits with the following command:

In the list, search for the last commit you want to merge with the others and take the one after it. For example, in the following result:

Tap  q to quit this view

I would like to merge from the first one until the “message 5” commit, then I will have to use the id from the commit “message 7” in the following command line to start a rebase:

This will open the editor, starting with the commits list, and followed by some commands you can use:

If you want, you can also rename your commits here like if you were doing an amend.

You will then have to replace the  pick commands by  squash commands (or s) for the lines you want to merge, except for the first one. When you’re finished, save the file  echap + ':wq'.

In some case, you will maybe have conflicts, you will have to resolve them before being able to continue. Don’t forget, after you’ve resolved them you need to do a  git rebase --continue .

Now, just finish by pushing this to your remote repository. If you already pushed those commits to your repository, you will have to force the push (option -f).

Read more on Git website: 7.6 Git Tools – Rewriting History

Git PublicKey denied on Mac OS X Sierra

If your Git publickey is denied to connect to your remote host (by pulling, pushing, etc.), first, check if you have actually an error to connect to your host:

If your SSH key is the issue, you should get this message:

Since Mac OS Sierra, the keychains are not autoloaded and must be explicitly called. So we will check if your keys are stored in the ssh-agent:

Verify in the list if you have your SSH key needed for your repository. If you don’t have any key, you will get this message:

To fix this issue, you will just have to add your SSH key in the ssh-agent with this command line:

A Reddit post on the subject with a permanent solution : difficulties with ssh-agent in macOS Sierra

Detect IE 10 and IE 11 with CSS

For Internet Explorer 9 and earlier version, we were able to apply CSS with conditional comments in our HTML, but since IE 10, this solution is not working anymore. So, what to do when you want to apply specific CSS for just Internet Explorer 10 and 11?

Keyfer Mathewson from Paper Leaf found a specific CSS media query only supported by this 2 versions of IE : -ms-high-contrast. This way, by setting this media query as a condition as true (active) or false (none), we can apply any CSS for only IE 10 and IE 11:

Source :

Mac OS El Capitan (10.11) blocking npm install, what to do?

The last version of Mac OS X, El Capitan (version 10.11), is sometimes blocking npm install. For exemple, if you want to install ios-deploy for Cordova with the following command, you will get an error message:

This will return something like this:

To prevent this error, you will need to add --unsafe-perm=true as parameter, which is preventing Mac OS X to block unsafe commands (of course, use it only with trusted plugins).

It will show the following message, but your plugin will successfully install :

Initialize Git repository

Looking for a way to initialize your Git repository for your project?

Here are the 3 methods with the command lines, depending on your situation:

Connect to a git repository and clone the project locally

Either you have already started developing your project or not, you can clone the git repository on your computer with those command lines:

Connect an existing folder to a git repository

If you started working on your computer and juste created your git repository, you can push your existing project to git with those command lines:

Git Global Setup

You can set up a global configuration for your git website with those command lines: