I have previously posted about using GitHub, an essential and commendable resource for participating in any development of Backdrop CMS and many other 'open source' projects. I have recently made slight progress beyond that elementary starting point, and have now taken my first steps into the Git world of Push and Pull, making use of GitHub repositories and JetBrain's PhpStorm software on my PC. What I am writing here will be very familiar and indeed trivial to regular users, who need read no more!
It seems that 'Git' is not one of those three letter acronyms, beloved of technologists and many others. It is the name given by Linus Torvalds, of Linux fame, for a 'version control system' for software development. Wikipedia tells us that 'Torvalds has quipped about the name git, which is British English slang meaning "unpleasant person". Torvalds said: "I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'." '
When working on porting a contributed module to Backdrop it is sufficient to develop and make changes to code on one's PC, then 'push' these changes directly into the repository one own's on GitHub. Once all the changes have been made, perhaps in one push or perhaps in several, the ownership of the repository can be transferred from your personal GitHub account to the shared backdrop-contrib area.
However, when working on a shared repository such as that for Backdrop's Core, proposed amendments must be submitted for approval and acceptance by means of a 'Pull Request'. As I understand it, a 'Pull Request is necessary because it is not permitted to 'push' a change into the main repository; rather, one must request that the owner accepts and 'pulls' your proposed change. To create a Pull Request one must first have a personal 'fork' (that is, a copy) of the Backdrop repository in one's own area in GitHub, because this is where your proposed change must exist prior to your Pull Request.
And so, in my method of working, there are the three copies of the Backdrop repository. One is the shared 'master' copy in GitHub, another is my personal copy or 'fork' in GitHub and the third is another copy in PhpStorm on my PC. I also have a fourth copy of Backdrop code on my testing webserver so that I can test any of my thoughts for alterations.
With the aid of PhpStorm I can examine the PHP code and make amendments to the copy on my PC. Then, once I am satisfied with the new code, I can 'commit' changes to my local PhpStorm repository on my PC and push the changes to my personal repository on GitHub. Once there, I can create a 'Pull Request' for the amendment, which includes writing a brief explanation of why the change is necessary or desirable.
Creating Repositories with PhpStorm
It has taken me a little while to figure out how best to use PhpStorm when copying a contributed module from drupal.org, adapting it for Backdrop, and then publishing it in the collection of contributed modules at github/backdrop-contrib. Here is a note of what I now do:
Starting from the welcome screen 'Welcome to PhpStorm' I use the Quick Start option 'Check out from Version Control', selecting the option 'GitHub'.
This needs the URL of the Drupal repository which is available at the Drupal project e.g. https://www.drupal.org/project/media for 'Media', and from the project's 'Version Control' page. Copy the URL part of the command line for setting up a repository for the first time, in this case
http://git.drupal.org/project/media.git
and paste this into PhpStorm 'Git Repository URL' in the 'Clone Repository' pane. PhpStorm will then create a new project directory e.g. 'media' and creates your local copy of the repository.
The next step is to change the branch code for your copy so that it will now start to become a Backdrop repository. To do this follow the PhpStorm navigation VCS > Git > Branches > New Branch and enter the new branch code e.g. 1.x-1.x. Now, using VCS > Git > Branches again, select the local copy of the Drupal branch, in this case 7.x-2.x, and delete it.
Now you are ready to create a repository on GitHub in your personal area, but you may choose first to make changes to your local repository. When you are ready to upload to GitHub, follow the PhpStorm menu choices VCS > Import into Version Control > Share project on GitHub.
Hopefully these notes will be of help to someone.