Git Notes – Basics

Initial commit

mkdir my_project
cd my_project
touch .gitignore
git init
git add .
git commit -m "Initial commit"
git remote add origin youruser@yourserver.com:/path/to/my_project.git
git push origin master

———————————————————————
Clone to local repo

git clone git@github.com:whatever folder-name
git add .
git commit -m "Initial commit"
git push origin master

Clone a specific Git branch

git clone -b my-branch git@github.com:user/myproject.git

Validate xml via terminal – Ubuntu

To validate xml via terminal

install xmlstarlet or xmlint

To install xmlstarlet,
http://installion.co.uk/ubuntu/vivid/universe/x/xmlstarlet/install/index.html
or
install via ubuntu software center

> apt-get install xmlstarlet

> xmlstarlet val "test.xml"

Output:

test.xml - valid

xmlint,
http://www.linuxask.com/questions/how-to-validate-the-format-of-a-xml-file-in-linux
http://stackoverflow.com/questions/4092812/tool-to-validate-an-xsd-on-ubuntu-linux

> xmllint --noout "file.xml"

Export MySQL Tables, Import MySQL Database, Add autoincrement to column through Terminal

Export Database

mysqldump -u root -p db > /path/db_backup.sql

Import Database

mysql -u root -ppassword db <  /var/www/tbl.sql

Export table

mysqldump -uroot -ppassword db tbl > /var/www/tbl.sql

Export table with WHERE clause

mysqldump --opt --user=username --password=password db tbl  --where="id>'207856'" > /var/www/tbl.sql

Import table

mysql -u root -ppassword db <  /var/www/tbl.sql

Add Autoincrement

ALTER TABLE tbl MODIFY COLUMN id INT auto_increment;