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
git push origin master

Clone to local repo

git clone folder-name
git add .
git commit -m "Initial commit"
git push origin master

Clone a specific Git branch

git clone -b my-branch

Validate xml via terminal – Ubuntu

To validate xml via terminal

install xmlstarlet or xmlint

To install xmlstarlet,
install via ubuntu software center

> apt-get install xmlstarlet

> xmlstarlet val "test.xml"


test.xml - valid


> 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;