Sunday, 10 November 2013
Wednesday, 18 September 2013
Useful Git Commands
Clone Command:
git clone "Your_remote_source_name"Check Status:
git statusCreate branch:
git branch "Name_of_your_new_branch"Change branch:
git checkout "Your_branch_name"View all branch:
git branchAdd project:
git add .Commit Project:
git commit -m "Your_comments"Push Project:
git push origin "Your branch Name"Pull Project:
git pull origin "Your branch Name"Clone specific branch in git:
git clone -b "Your_branch_name" "Your_remote_source_name"Rename local branch in git:
git branch -m "old_branch_name" "new_branch_name"If you want to rename the current branch, you can simply do:
git branch -m "new_branch_name"Delete specific branch in git:
git branch -D "Your_branch_name"To Remove deleted files from Git Repository use following command:
git add .git commit -a -m "Message_in_quote"
Initialize directory and push to remote repository:
git initgit add .
git commit -m "first commit"
git remote add origin your-remote-repo-url
git push -u origin master OR git clone origin master
Learn Git branching:
https://learngitbranching.js.org/GitSheet
https://gitsheet.wtf/Thursday, 28 February 2013
Command Line import-export database in Windows 7
Import .csv file
⇛ Step 1: Copy your desired importing file into the mysql using following steps:
Open the wamp installed folder (lets consider it as a D:\ drive)
D:\wamp\bin\mysql\mysql5.5.20\bin
Paste your database file there (in bin folder)
Right click on (Start->All Programs->Accessories->Command Prompt) Command Prompt and click on ''Run as administrator''
Execute the following command:
D:\wamp\bin\mysql\mysql5.5.20\bin
mysql -p -uusername
Example: mysql -p -uroot
Press ''ENTER'', then it will prompt you to enter the password. Provide the appropriate password to it, then it will go in mysql mode like this:
mysql>
⇛ Step 2: Select your database name using command
use [database name]
Example: use mydatabase
⇛ Step 3: Here is the following command for importing .csv file (''Make sure that you copied your desired files into bin folder'')
load data local infile 'filename.csv' into table tablename fields terminated by 'terminate character' enclosed by 'enclosed character' lines terminated by 'terminate character'(col1,col2,@ignore, col4);
Example:
load data local infile 'user.csv' into table user fields terminated by '|' enclosed by ' ” '
lines terminated by '\n' (id,username,@ignore, password);
''@ignore'' specifies the extra column in the csv which you don't want to import into the table.
Import .sql file
⇛ Step 1: Use ''same'' step 1 as Import.csv file section
⇛ Step 2: After that for importing .sql from command line you need to use following command
mysql -uusername -p databasename < filename.sql
Example'': mysql -uroot -p mydatabase < user.sql
Export database to the .sql file
⇛ Step 1: Open the command prompt ('''Run as administrator''') and execute following command:
D:\wamp\bin\mysql\mysql5.5.20\bin>
⇛ Step 2: For exporting database from command line you need to use following command
mysqldump -uusername -p databasename > filename.sql
Example: mysqldump -uroot -p mydatabase > mynewdb.sql
Export table to the .sql file
⇛ Step 1: Open the command prompt (''Run as administrator'') and execute following command:
D:\wamp\bin\mysql\mysql5.5.20\bin>
⇛ Step 2: For exporting table from command line you need to use following command
mysqldump -uusername -p databasename tablename > filename.sql
Example: mysqldump -uroot -p mydatabase mytable > newtable.sql
Export Multiple tables to the .sql file
mysqldump -u username -p databasename table1 [table2 ...]> path/to/dump.sql
Example: mysqldump -uroot -p mydatabase tb1 tb2 tb3 > tbsdetails.sql