GoogleContactsEventsNotifier

Git mini-tutorial

Before starting the tutorial, it is important to clarify definitions of the following for beginners:

This is a “just the steps” mini-tutorial. It is aimed at first-time users of Git, or relatively new users wanting to know the steps this project uses in the context of Github. If any step is confusing it should be easy to find details & explanations by searching Github documentation, or googling the command and especially looking at stackoverflow answers that come up for it. The instructions below are for the example-case of a first-time contributor adding a language to the translation-table.

Text with preceding ## is either for you to replace, for example:

a_variable=## Replace this with your favourite food

becomes:

a_variable=banana

or instructions to follow, for example:

echo "silly command"
## Repeat the above 3 times

becomes:

echo "silly command"
echo "silly command"
echo "silly command"
  1. Ensure you have the git commandline tool installed and usable in a shell. If on Windows and you haven’t already installed a “POSIX compatible” shell (“command line”), the simplest thing is to install the bundled git package which includes its own shell.
  2. In your browser, logged into Github, in the top-right corner of this repo, click the Fork icon which will create your own fork.
  3. In the shell do the following. Setting the variables at the beginning is just to make this tutorial more readable, you can obviously enter the text directly each time instead of using variables if you prefer:
     common_dir=## Replace this with a common directory to hold your repositories
     user=## Replace this with your github username
     lang=## Replace this with your translation language
    
     mkdir -p "${common_dir}"
     cd "${common_dir}"
    
  4. In the shell clone your fork to a local directory. For the simpler https method (but which requires you to enter your password whenever you do remote actions), do:
     git clone https://github.com/${user}/GoogleContactsEventsNotifier.git
    

    If you optionally want to be more advanced and use ssh instead of https then do the documented steps for adding your ssh public-key to your github account if you haven’t already, and then do:

     git clone git@github.com:${user}/GoogleContactsEventsNotifier.git
    
  5. In the shell do the following to create the new branch with your changes. You will need to know which existing upstream branch it should be based on. Although basing it on the upstream master branch is usually what you want, sometimes you may need to base it on an “upstream feature/fix branch” which the maintainers will later merge to their master branch (if in doubt ask the maintainers):
     upstream_branch=## Replace this with the upstream branch
    
     cd GoogleContactsEventsNotifier
     git checkout -b ${lang}-translations ${upstream_branch}
     ## Edit code.gs in text editor, find the commented text at the bottom of the
     ## translation-table, create the translations as per the instructions there,
     ## then save & exit.
     git add code.gs
     git commit -m "${lang} translations"
     git push origin ${lang}-translations
    
  6. In your browser, logged into Github, visit your forked repo at https://github.com/${user}/GoogleContactsEventsNotifier, and there will be a notification about a recently added branch, asking if you wish to open it as a Pull Request. Do that, remembering that if the Pull Request is based on an upstream branch other than the default master, then you should select that while opening it.

Below are other steps you might need to take sometimes. Don’t worry though, if any of them are too intimidating the upstream maintainers can usually make the changes to your branch for you on request - when they have time! - and you will still retain “authorship” of your commits:

In the above steps:

There are many more aspects to git for the adventurous, but they are out of scope for this intro.