François Sevaistre
VP of Engineering

@ Pretto

What is Git?

"I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'Git'"
 

 

 - Linux Torvalds

Backup

&
Version control

  • A blob is the content of a file. Blobs have no proper file name, time stamps, or other metadata.
  • A tree object is the equivalent of a directory. It contains a list of file names, each with a reference to a blob or tree object that is that file, symbolic link, or directory's contents.
  • A commit object links tree objects together into a history. It contains the name of a tree object, a time stamp, a log message, and the names of parent commit objects.
  • A tag object is a container that contains a reference to another object.

4 object types

Gitflow

Github flow

Gitlab flow

Git messages

Guidelines

  1. Prefix the subject line ([Feat], [Fix], [Chore]...)
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line

Commit early
Commit often
Squash
Squash & Merge

Merge / rebase difference

- A - B - C - D - remote HEAD
    \
      E - F - G - local HEAD



- A - B - C - D - remote HEAD
    \                         \
      E - F - G - local HEAD - new local HEAD



- A - B - C - D - remote HEAD - E' - F' - G' - local HEAD'

After merge

After rebase

Cheatsheet

Base commands

  • git checkout master
  • git pull
  • git checkout -b new-branch
  • git stash
  • git stash pop
  • git add -p
  • git commit
  • git push --set-upstream origin new-branch

Workspaces

  • Stash
  • Workspace
  • Index
  • Local repository
  • Upstream repository

 

 

Interactive cheatsheet

Useful commands

  • Woops, I committed too quickly:
    • Reset last commit: git reset HEAD^
    • Edit last commit: git commit --amend
  • Woops, what have I done?
    • git reflog

More commands

Interactive rebase

  • git rebase -i HEAD~5
  • git rebase -i another-branch

Git bisect

Thanks!

Git

By François Sevaistre

Git

A quick git presentation

  • 119