GAMEON

Hands-on experiment building microservices and cloud native applications

Git

git
xkcd: Git

We use submodules to facilitate grabbing all the core servies in one fell swoop.

Yes, yes we know, Git Submodules are not a cake walk. But we believe the convenience of being able to grab the set of core services as a whole is worth it. If you plan to contribute back (as we hope you will), some reading may be required.

References for using Git

Safety precautions for using git with submodules

If you end up using submodules in anger, consider the following:

  • Make status submodule aware:
    git config --global status.submoduleSummary true
  • Make diff submodule aware:
    git config --global diff.submodule log
  • From the parent repository (gameon):
    • Use rebase instead of merge:
      git config alias.srebase 'submodule update --remote --rebase'
    • Recursive diff.
      git config alias.sdiff '!'"git diff && git submodule foreach 'git diff'"
    • Safe(r) push:
      git config alias.spush 'push --recurse-submodules=check'

Signing Commits

If you’re going to contribute code to Game On!, then you need to certify that you agree to the Developer’s Certificate of Origin, as documented in our contribution guidelines. You must use your real name.

You can make this easy with the following alias:

git config alias.cs 'commit -s'

Set your name and email (for the project only), using:

git config user.email "joe.smith@email.com>"
git config user.name "Joe Smith"

Other useful aliases

Note global vs. project-specific, make up your own mind which to use.

  • Undo staged changes:
    git config --global alias.unstage 'reset HEAD --'
  • See last commit:
    git config --global alias.last 'log -1 HEAD'