Git Clone
Git: Clone repository.
  1. Run the code in PowerShell -> WSL:
                                                        
    git clone git@github.com:livingtech/"repository_name".git">
                                                        
                                                    
  2. Run the code in PowerShell -> WSL:
                                                        
    cd "project_folder_name"
                                                        
                                                    
  3. Run the code in PowerShell -> WSL:
                                                        
    git branch -a
                                                        
                                                    
  4. Run the code in PowerShell -> WSL:
                                                        
    git checkout staging
                                                        
                                                    
Export Database
The command to export the database locally.
  1. Run the code in PowerShell -> WSL:
                                                        
    cd "project folder"
                                                        
                                                    
  2. Run the code in PowerShell -> WSL:
                                                        
    ddev export-db --file=/tmp/"name".sql.gz
                                                        
                                                    
Import Database
The command to import a database locally.
  1. Run the code in PowerShell -> WSL:
                                                        
    cd
                                                        
                                                    
  2. Copy the cleardb.sql inside the home > "user_name" folder from Ubuntu.
  3. Run the code in PowerShell -> WSL:
                                                        
    docker exec -i ddev-"database_name"-db mysql -uroot db < cleardb.sql
                                                        
                                                    
  4. Run the code in PowerShell -> WSL:
                                                        
    docker exec -i ddev-"database_name"-db mysql -uroot db < "database_name".sql
                                                        
                                                    
  5. cleardb.sql - Code:
                                                        
    SET FOREIGN_KEY_CHECKS = 0;
    SET GROUP_CONCAT_MAX_LEN=32768;
    SET @tables = NULL;
    SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
    FROM information_schema.tables
    WHERE table_schema = (SELECT DATABASE());
    SELECT IFNULL(@tables,'dummy') INTO @tables;
    SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
    PREPARE stmt FROM @tables;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt;
    SET FOREIGN_KEY_CHECKS = 1;
                                                        
                                                    
Zip / Unzip
Commands to zip and unzip locally.
  1. To zip a folder, run the code in PowerShell -> WSL:
                                                        
    zip -r file.zip .
                                                        
                                                    
  2. To unzip a file, run the code in PowerShell -> WSL:
                                                        
    unzip file.zip
                                                        
                                                    
Archive using tar

Creating archives using ZIP oftens messes up special characters like "Umlaute" or empty spaces. To avoid problems, use "tar" instead.

Parameter

  • -c = compress
  • -x = extract
  • -z = gzip compression
  • -f = filename
  1. Use tar to compress all files and subfolders of current directory:
                                                        
    tar -czf myArchive.tar.gz .
                                                        
                                                    
  2. Compress file excluding own archive file:
                                                        
    tar -czf myArchive.tar.gz --exclude=myArchive.tar.gz .
                                                        
                                                    
  3. Extract all files/folders from tar archive to current directory:
                                                        
    tar -xzf myArchive.tar.gz