git: Useful commands

Cloning a branch

This is mostly a notes for me… for cloning a branch directly putting it in directory of your choosing.

Here is the command :

git clone -b my-branch ssh:/.....  my-dir

you don’t have to clone, cd, then change branch …etc… and you have it in directory of your choosing.

Revert changes

This is how to revert all changes you made after the last commit. So if you think your latest changes are no good you can rollback to the last stable state, like in the databases.

git reset HEAD --hard