Helpful Git Commands

Cherry-picking certain commits into a branch

git checkout release-branch
git cherry-pick xyzabc123
git push origin release-branch

Undoing change from a merged PR from a branch

Checkout the branch where the PR was merged and run the following command –

git revert -m 1 commit_id_of_merge_pr

git revert makes new commits to remove old commits in a way while keeping the commit history. This is the recommended way to undo a commit. There is also another command called git reset , but this doesn’t keep the history of your commits.

Undoing change to a particular commit

git revert --no-commit commit_sha..HEAD

Push reference of one branch to another

git push origin master:production

List commit logs with reference

git reflog

Setting Up WordPress in your own Server

Download and extract WordPress


tar -xzvf latest.tar.gz

Create a database and a user and link that to your WordPress

You can use either MySQL database or MariaDB as a backend for your WordPress. In this tutorial, I’ll show using MySQL.

# . Install mysql

sudo apt-get install mysql-server

# Note: the root password can be found in /etc/mysql/debian.cnf in Ubuntu

Next, log into your mysql-server using mysql-client and create a database and a user for wordpress

mysql -u root -p root_password

mysql> CREATE DATABASE wordpressdb1;
mysql> GRANT ALL PRIVILEGES ON databasename.* TO "wordpressdb1user"@"%"
-> IDENTIFIED BY "wordpressdb1user_pass"; 

Now, link the database to wordpress by copying wp-config-sample.php to wp-config.php and editing it as follows:

define( 'DB_NAME', 'wordpressdb1' );

/** MySQL database username */
 define( 'DB_USER', 'wordpressdb1user' );

/** MySQL database password */
define( 'DB_PASSWORD', 'wordpressdb1user_pass' );

Install Php and Apache2

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

sudo apt-get install apache2

Install WordPress

When you have apache2 server, the http files are served from /var/www/html/ folder. Move all the files and folder of wordpress to this folder and restart apache2 server by running the command sudo service apache2 restart

Now, point your browser to http://ip-address-of-your-machine/wp-admin/install.php and the wordpress installation will start.