andersch.dev

<2022-04-18 Mon>

Git

Git is a distributed version control system. It was created to aid in the development of the Linux kernel.

How to write commits

  • First line: "when applied, this commit will…" (50 char limit)
    • Can become subject line of an email
    • text like "[PATCH linux-usb v2 0/13]" may get added to the beginning
  • Second line empty
  • Commit description at 72 columns (standard width of email)
    • rationale for the change
    • trade-offs and limitations of the approach

git merge vs git rebase

git-merge-graph-1.png

git-merge-graph-2.png

git-rebase-graph-1.png

git-rebase-graph-2.png

git-subrepo

git-subrepo is an alternative to git submodule and git subtree.

With a subrepo, operations on the main repo (e.g. cloning or commiting) work transparently without the need of extra commands or the need of git-subrepo as a dependency. Only when needing to push to the remote subrepo or pulling into the local subrepo you need to use below commands (and git-subrepo needs to be installed).

How to use:

  • While in main git repo, clone a remote repo as a subrepo git subrepo clone <remote-url> [<subdir>]
  • Push/pull changes with git subrepo push/pull

Git over Email

Git provides tools for collaborating over email. This way, patches can be submitted, applied and talked about in an email chain.

See

Resources