Git Commands Cheat Sheet

No Git command cheat sheet would be complete without a section on the Git vocabulary, so we’ve included one to help you get to grips with how Git works and how the commands are run on various entities. In fact, let’s begin there:

Git Commands Cheat Sheet – Vocabulary

#

Git Command

What it Does

1 Bare Repository Repository that doesn’t have a working directory.
2 Branch An active area of development in Git. The newest commit displays the end of the branch.
3 Blame Refers to the most recent alteration to every line in the file. Shows Author, Revision, and Time.
4 Checkout This is talking about the process whereby a particular commit is chosen from the repository and the condition of the file associated with it and the directory tree are reproduced in the working directory.
5 Commit Record of a moment in Git history containing details of a changeset.
6 Diff The difference in changes between saved changes or two Commits.
7 Detached Head The state in which a specific commit is checked out rather than a branch.
8 Fetch Retrieves the most recent changes in the branch and the local or remote repositories.
9 Fork When you Fork the repository, you can add Commits and add Pull Requests.
10 Hash A unique SHA1 code for each Commit
11 Head The name of the Commit at the end of a Branch
12 Index A group of files that hold state information.
13 Merge Includes changes from named commits (from when their histories split from the current branch) into the current branch.
14 Master Git’s default development Branch
15 Origin This is the default Upstream Repository
16 Pull Request Suggests changes into the Master Branch
17 Push Pushes new changes once they’ve been committed
18 Repository A group of Commits, Branches and Tags to identify Commits.
19 Working Tree The directory of files that you are currently working on

Git Commands Cheat Sheet – Configuration

#

Git Command

Description

1 git config –global user.name Sets the username to be used for every action
2 git config –global user.email Sets the email to be used for every action.
3 git config –global alias. Generates a shortcut for the Git command.
4 git config –system core.editor Sets the text editor for all command actions.
5 git config –global –edit Opens global configuration file in the text editor to enable manual editing.
6 git config –global color.ui auto Turns on colour for command line outputs as a visual aid.

Git Cheat Sheet – Set Up a Git Repository

#

Git Command

Description

1 git init Initializes an empty Git repository in the current project.
2 git clone (Repo URL) Clones the repository from GitHub to the project folder.
3 git clone (Repo URL) (Folder) Clones the repository to a specific folder.
4 git remote add origin

https://github.com/username/(repo_name).git

Creates a remote repository that points to your current GitHub repository.
5 git remote Displays the name of remote repositories.
6 git remote -v Displays the name and URL of remote repositories.
7 git remote rm (remote repo name) Gets rid of a remote repository.
8 git remote set-url origin (git URL) Changes a repository URL.
9 git fetch Obtains the most recent changes from the origin but doesn’t merge them.
10 git pull Obtains the most recent changes from the origin and merges them.

Git Cheat Sheet – Local File Changes

#

Git Command

Description

1 git add (file name) Adds current file changes to staging.
2 git add . Adds changes for the whole directory to staging but without deleting files.
3 git add -A Adds every new, modified, and deleted file to staging.
4 git rm (file_name) Stops tracking a file and gets rid it.
5 git rm –cached (file_name) Stops tracking the current file.
6 git mv (file_name) (new_file_name) Alters the filename and gets it ready for Commit.
7 git checkout <deleted file name> Undeletes a file and gets it ready for Commit
8 git status Displays the status of modified files.
9 git ls-files –other –ignored –exclude-standard Displays a list of each ignored file.
10 git diff Displays staged changes in the working directory and index.
11 git diff –staged Displays differences in files between the most recent version and staging.
12 git diff (file_name) Displays changes between a single file and the most recent Commit.

Git Commands Cheat Sheet – Declare Commits

#

Git Command

Description

1 git commit -m “(message)” Saves changes along with a custom message.
2 git commit -am “(message)” Adds all changes to staging and saves them with a custom message.
3 git checkout Switches to the provided Commit.
4 git show Outputs content changes and metadata for a particular Commit.
5 git reset –hard Rolls back all history and changes for a specific Commit.
6 git reset –hard Head Rolls back all local changes in the working directory.
7 git log Displays change history.
8 git log -p Displays the full page for each Commit.
9 git log -oneline Displays a list of Commits and a simple message.
10 git log –follow (file_name) Shows the history of the present file.
11 git blame (file_name) Displays all changes and the user’s name.
12 git stash Does an Interim save of all tracked files that have been modified.
13 git stash pop Restores files that were stashed most recently.
14 git stash list Displays all stash changesets.
15 git stash apply Applies the most recent stashed contents.
16 git stash drop Gets rid of the most recently stashed files
17 git stash apply (stash id) Re-applies content of a particular stash by ID.
18 git stash drop (stash_id) Drops particular stash content by ID.
19 git push Pushes changes to the Origin.
16 git push origin (branch_name) Pushes branch to the Origin.
17 Git push -f origin (branch_name) Force pushes the changes to the Origin.
18 git tag (tag_name) Specifies a tag for a version.
19 git push Pushes changes to the Origin.

Git Commands Cheat Sheet – Branching

#

Git Command

Description

1 git branch Displays a list of every branch.
2 git branch Makes a new branch.
3 git branch -m Changes the name of a branch.
4 git branch -a Lists both local and remote branches.
5 git checkout -b Creates a branch and switches to it.
6 git checkout Changes to a particular branch.
7 git checkout -b origin/ Puts a remote branch from the origin in the local directory.
8 git branch -d Deletes the specified branch.
9 git merge Merges the current branch with the master (first checkout to master)
10 git rebase Integrates changes from one branch into another by rewriting the commit history to produce a linear succession of commits.
11 git rebase Rebases the current branch onto the base, which can be a Commit ID or a branch name.
12 git fetch remote Fetches the specified branch from the repository.
13 git diff .. Shows the differences between two branches.
14 git pull –rebase Fetches the remote copy of the current branch and rebases it into the local copy.
15 git push –all Pushes all the local branches to the specified remote repository.

Plesk and Git Support

Plesk lets you integrate with Git, because for most web developers it’s their go-to code management system. Git makes it easy to handle initial publishing and subsequent updates by deploying your website from repositories to a public directory.

Here’s how to get started with Git:

  1. Install the Git extension in Plesk.
  2. Create a domain in Plesk with a service plan that lets you give management permission to Git.

There are two types of repositories that you can add in Plesk, and you’ll choose the one that best fits your use case:

  1. Keep it local with a repository on your own machine. In this scenario, you send the changes to Plesk from your local repository, and then Plesk deploys the changes to your website.
  2. Use Git hosting remotely. You might want to do it this way if you’re already using a remote repository in BitBucket (bitbucket.org) or GitHub (github.com). You forward your changes to the remote repository, then Plesk gets them from it and deploys them to your website.

When you’ve got Git repositories enabled in your domain, you’ll be able to see a list of the ones that have been created on its page. For each one you’ll see the name, the current branch and the deployment path. The Deploy button (look it for it near the repository name) lets you deploy the files from a repository (if it’s been set up for manual deployment) and the Pull Updates button lets you get the changes from the remote repository.

Conclusion

It’s much easier to work on a complex project when you have a list of Git commands in front of you, so we hope that this Git command cheat sheet proves to be useful.

Top Hosting Providers for WordPress Developer Features

Hosting Providers for WordPress

Not all hosting providers are developer-friendly. They’re nice guys and all – but they simply may not have what you need to grow. But what WordPress developer features should you be looking out for? Let’s talk about PHP management and auto-updates, WP-CLI, WordPress Mass Management, Secure Shell (SSH) Access, Git.

Important WordPress Developer Features

Important WordPress Developer Features

We all want to make a great impression. So do hosting providers when presenting themselves to the developers. However, you should know better what’s just glitter and what’s substance. Here are the winning features they should provide.

PHP Management and Auto-Updates

One of the reasons you may choose to buy something over another is the flexibility of change anytime you want. The same goes for hosting providers who offer the ability to change the version of PHP used for WordPress. They may also let you activate/deactivate various PHP modules. Where PHP is involved, you need to look out for hosting providers with top performance too.

Coming second as preference are the providers who only offer the ability to change the version of PHP used for WordPress – but not PHP modules. Only being able to modify PHP variables without a PHP version or module management just isn’t good enough to consider.

Hosters need to find a way for WordPress core to update itself automatically, without having to take any actions. Auto-updates can be by default – and it’s equally fine if a setup wizard or control panel is in place. Providers who offer no assistance with updates or management around updates don’t make the cut.

WP-CLI

Nobody likes bottlenecks – hence, providers who offer the ability to utilize WordPress WP-CLI as a built-in feature are excellent choices. Or simply if they allow the use of WP-CLI from local or remote hosting.

WordPress Mass Management

Multitasking is the way forward in almost everything we do nowadays. In the WordPress sphere, this means being able to perform multiple actions with a single click – Or even the same action on multiple sites simultaneously. Such as applying updates to WordPress core, plugins and/or themes, security checks or any sort of analysis.

For more info on how you can get a handle on self-management, check out our detailed article on Managed vs. Unmanaged WordPress Hosting. Choosing managed or unmanaged hosting depends on your needs, but ultimately WordPress mass management should fall into your consideration.

Secure Shell (SSH) Access

Providers who offer the ability to access WordPress via SSH go on the winning list. SSH does not need to be available by default. But if the customer wants it, the provider should make it easy to enable it.

Git

We like it neat. Git allows you to group the changes in the source code so you have them at hand later on. Providers who offer some type of Git integration or services are part of this category.

Top-Performing Hosters for WordPress Developer Features

Top Hosters for WordPress

When it comes to WordPress web developer top performers, in the Cloud Spectator Report you can find the winners. The only ones who got an A, but not an A+ were HOSTPRESS, CONETIX, and ZNETLIVE with 92%. The hosting providers have in place WP-CLI, mass management, auto-updates, SSH updates, Git, and only partial PHP management.

Second rankers are A2Hosting, BLUEHOST, HOSTINGER. They have full PHP management in place, but missed on implementing either Git, in case of A2Hosting, or mass management – the latter two.

The Raspberry Awards in this category go to 34SP.com, FlyWheel, and Pressable. All of them failed to implement four of the must-haves to get a developer-friendly badge. Therefore, we’ve narrowed down the essential list of WordPress developer features that hosting providers shouldn’t miss. Look out for PHP management, WP-CLI, mass management, Git, and SSH access.

WordPress Features, from Plesk to Developers

Plesk WordPress Toolkit makes a great impression on even the more advanced developers for its one-click “build – secure – run” features. That are simple, yet appeal to both amateurs and experts.

WordPress Toolkit

Build with Plesk WordPress Toolkit

When building a WordPress website, a developer needs to be fast and furious. Plesk’s WordPress Toolkit provides easy installation, a staging environment, and theme and plugin management. In one click, you’ll download WordPress, then create a database with a DB user and an admin account.

The staging environment allows you to experiment with new ideas and only when you are convinced by them, will you go forward. You can also push the on/off button for plugins on one or several WordPress instances. From WordPress Toolkit 4.0 upwards, you even get remote management. Basically letting you bring any WordPress instances on remote Plesk servers to your WordPress Toolkit management area.

Security at Hand

Click on the magic Secure button to detect and protect your core installations. Just check for the items you wish to harden, push the button and carry on. Here you’re getting the latest security recommendations and best practices from WP Codex and WP security experts. Meaning you don’t need to be a security expert or have an on-hand team – because it’s already there for you.

Run and Play

When you hiccup, you drink a glass of water. When your site hiccups, you run Restore Points, and everything goes the way it used to be. Bug invasion? Plesk WordPress Toolkit is going to keep you away from it with debug management.

When updating your WordPress plugins or themes, go into the maintenance mode with a single click. Moreover, with WP-CLI, you can import a database, create a new user, and update themes in a flash.

It’s not an amateur tool, so it’s for the WordPress developers with a bit more experience.  But it’s a small purchase that helps you save a lot of time. Hence becoming more productive, cost-effective – and ultimately more profitable.

We’d love to hear your experiences with developer-friendly providers. So drop a line in the comments and let us know if we got it right or wrong!

The 8 helpful Git Commands you may not know about

The 8 helpful Git Commands you may not know about - Plesk

As you may well know, Git is the most popular source code management system with over 70% of developers using Git for their projects. But, how much do you know about Git’s functionality and what it can do to ease your workload? Let’s run through the top eight git commands many software engineers don’t know about.

1.Git branch -m old-name new-name

The first command helps you Rename Branches Locally. And if you want to rename the currently checked out branch, you can shorten this command on the following form:  git branch -m new-name

2.Git diff –name-only –diff-filter=U | uniq | xargs $EDITOR

Rebasing has some risks, like the appearance of some conflicts in several files. Use this command to open all the files which have problems that need solving.

3.Git whatchanged –since=’2 week ago’

This command is quite useful to show the changes introduced by each commit from the last two weeks.

4.Git stash -p

Want to stash any part of any file? Just use this command. You can also use the –patch option to stash select parts of each tracked file.

5. Git cherrypick

Although this git command needs your working tree to be clean, it is still quite useful. You can apply the change of each current commit, recording a new commit for each.

6.Git gc –prune=now –aggressive

This is your ideal command if you’re looking to optimize the repository locally.

7.Git commit –amend

Modify the most recent commit by combining staged changes with the previous commit instead of creating a new one. It’s also useful for editing the previous commit message without changing its snapshot.

8.Git branch –contains <commit>

Do you want to know what happens once you know the commit? What versions are being affected by a bug? Just try this git command. It will show you all the branches that contain a particular commit.

Discover more Git commands here.

Experience Git on Plesk

Think of what could happen if you add Git as a layer onto Plesk – the simple site management platform. You can deploy your website content even easier by pushing it to a local Git repository or pulling from a remote one. Then, choose whether you want to deploy manually and get full control, or just enable automatic deployment and save time.

Experience Git on Plesk

Get the option of creating different branches in one repository so that you can separate the staging code form the production code. You know – since Plesk lets you have a free staging environment with WordPress Toolkit. Also, you are free to choose your software engineering service – GitHub, BitBucket or Travis – all are fine while using Plesk’s Git extension.

Plesk Multiple Server Management – How it Works

The biggest challenges we run into as system admins and web experts are multiple server managementsite management, and maintenance. If we don’t do this right, we face consequences. We waste time and resources. So it’s essential to own a web hosting control panel – making the whole thing simpler. While being able to create sites, apps, automate tasks, handle website security, and more.

Plesk Onyx is an all-around control panel and WebOps solution. Devs rely on it for its coding environment. Not to mention everyday tasks as it offers many extensions. Including Node.js, Ruby, WordPress Toolkit, Joomla Toolkit and more.

Plesk Control Panel Bonuses

Plesk supports Docker, which empowers developers to create and manage their new software. Do this by managing and deploying all Docker containers straight from the control panel. Additionally, Plesk offers GitHub integrations – deploying apps and sites quick from a Git repository, remote or local.

Plesk server management continues to add to its multiple server management capabilities. By giving absolute control of multiple accounts and subscriptions across all servers.

Multiple Server Management with One Control Panel

Plesk’s Multi Server extension lets you administrate multiple servers and routine tasks with just one control panel. Doesn’t matter if you’re a hosting provider, reseller, or manage your own hosting. Constantly switching between several hostnames, username IDs, and so on is exhausting.

Plesk designed its Multi Server extension with this in mind. For effective and secure multiple server management. With this extension, you can perform hosting actions on many servers. And manage the infrastructure with ease. This because memorizing hostnames, passwords, and login identifications become unnecessary.

It’s similar to simple web server management. However, the same scope of features is related to a number of servers. All through a single control panel.

Use Plesk WordPress Edition

Why the Multiple Server Management Extension?

You can install this extension directly from Plesk’s extension list. But note that you need to install Onyx on all your servers first. You’ll have all the features that Plesk has. But with this extension, you’ll gain additional functionalities:

  • Managing as many customer subscriptions and accounts as you want from your control panel.
  • Choosing between any billing systems you like, including yours.

It’s a very useful business-ready platform. Ideal for development studios and web designers who manage many different sites and clients.

What Plesk Multi-server management Consists of

  • At least two nodes which are all connected to each other using the SDK extension.
  • The basic two nodes include Service nodes and management nodes.
  • Plesk multi-server that will be installed on all extensions with all nodes.
  • All of the nodes that will have the same license key and configurations.

Subscriptions and Customer Account Management

So we said that this system comes with two nodes – service and management nodes. You use the service node to manage hosting. Because it has the power to host sites, system databases and emails. It also ensures quality load-balancing. This is important since it decides which node will provide hosting for the new subscription. Meanwhile, the multi-server extension has a separate API extending from Plesk’s API. Giving the power to add commands within the system.

The management node is a single Onyx server. Useful for both customers and administrators. And it servers a single point login spot. All new customer accounts go into this node too. But remember, this node has no tools for any hosting actions. So we use the management node to create accounts and the service node to manage their hosting.

Additionally, when a customer logs into the management node, they see and manage all subscriptions hosted through service nodes. You can see the following information on the subscription tab:

  • Status – a status sign that shows whether a subscription is successful or not.
  • A service node IP address that is provisioned for a certain subscription.

This is how Plesk server management can help you with web server management and multiple server management. You as an admin can rely on this comprehensive platform for its capabilities at all times.

UPDATE: Starting from Plesk Onyx 17.8 Multi Server feature is no longer available

Gitman: When Plesk meets Git

Gitman - When Plesk meets Git

It doesn’t matter if we develop a tiny website or a huge web portal – someday we have to deploy it to a public web server. Our noble ancestors used to deploy their web projects via FTP or, if they were concerned about security, SFTP. These simple and reliable tools serve us well to this day. But at the same time, today there are more interesting ways for deployment. One of these ways is pushing to a remote git repo, or simply “push-to-deploy”.

“Push-to-deploy” is very popular and is supported by various services like GitHub, Heroku, Google Cloud Platform, and so on.
Today, I am happy to announce “push-to-deploy” support in Plesk.

Continue reading