not just version control


v2.1 by George Litos

a bit of history

Git was originally authored by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Since 2005, Junio Hamano has been the core maintainer.

As with most other distributed version control systems, and unlike most client–server systems, every Git directory on every computer is a full-fledged repository with complete history and full version-tracking abilities, independent of network access or a central server.

Git is free and open-source software distributed under the GPL-2.0-only license.

Tech Talk

Linus Torvalds on git

December 12, 2022

Git is alive and actively developed

Git Official site

Stack Overflow Developer Survey 2021

Over 90% of respondents use Git, suggesting that it is a fundamental tool to being a developer.

Stack Overflow Developer Survey 2022

No other technology is as widely used as Git. Especially among Professional Developers.

Q: What are the primary version control systems you use?


Working directory - repo the working directory is the folder on your system that you want to track. Where you develop your project. Everything git related is inside the .git folder. Serverless.
Remote repository Remote repositories are versions of your project that are hosted elsewhere. You can have several of them, each one is either RO or RW for you.
Git files Inside the working directory and beneath, you might find some git related files
.gitattributes how to handle files
.gitignore what to ignore
.gitkeep keep an empty dir
Tracked files
Tracked files are the files in the working directory (repository) that Git manages.


The Staging Area
The intermediary between the working directory and the project history.
Commit is the process of adding any changes in tracked files. Git will keep track of all the changes in the Committed History.


Commit message
The commit message is a summary and description of a commit action.
Branches (develop, feature, master)
A branch is a set of the repo tracked files. Git allows you to compare and merge branches. It can also be used to organize collaboration inside the repo, fix specific bugs, or create new features.


Copy code changes from one branch to another.

(not really git)

You clone a public repo, make changes and contribute back with a PR.


Pull/Merge request (PR)
A PR is a request to the repository owner to merge your changes back into the original code base.

git init

Install git, then

git config --global "John Smith"
git config --global
git config --global init.defaultBranch main

Create a new folder for your project and add a file under version control

mkdir -p ~/projects/git-test
cd ~/projects/git-test
git init
nano new_file
git add .

Commit the changes

$ git commit -m "Initial commit"
[master (root-commit) 19632d1] Add new file
 1 file changed, 1 insertion(+)
 create mode 100644 new-file

every commit is unique, it contains:

a snapshot of the project (a tree with a compressed blob for each file), user information, date, commit message, SHA-1 checksum.
$ git log
commit 81752cd6a514fd2595c40f27c783d6887f84e6e6
Author: John Smith <>
Date:   Thu Apr 7 15:17:45 2022 +0000

    Initial commit

don’t fear the git!

Git will help 🥷

  • Cleanup your code base
  • Backup your code
  • Merge Requests

  • Code Review

  • CI/CD 🤖 (coming soon…)

    • Code linting / beautify
    • Automated Testing
  • Contribute to open source

  • Be famous 💰


A successful Git branching model

By Vincent Driessen

Gitflow Workflow

Atlassian Tutorial

1. Start a project

  • Divide work in repositories
  • Choose workflow (advanced git flow)
  • Select which files to keep under version control

2. Work on a project

  • Working on a topic/feature/bugfix branch
  • Splitting changes into logically separate steps
  • Write a good commit message (e.g. present tense, short and meaningfull)
  • Preparing changes for submission

3. Integrate

  • Submitting and describing changes
  • Merge request to the main branch
  • Delete working branch


pull the servers’ plug

  • Rebuild and restart services anytime
  • Do a server reboot
  • 🔥 Change servers and redeploy

Rebuild 🏠

install docker
git clone repo
  > follow the instructions

in case of fire

practice and use everywhere

….you don’t need a server

git init
git commit -a -m 'Commit message'
git checkout -b new_branch
git status

When you don’t know what to do type:

$ git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   docker-compose.yml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

no changes added to commit (use "git add" and/or "git commit -a")

Git tips

  • Learn the command line basics
  • …and then use a GUI
  • you don’t have to use only 1 (git) client
  • git reset –hard
  • Use aliases (cmdline)
  • Use the log/graph 😛
  • Don’t panic, recovery is (almost) always possible

Resolve merge conflicts with GUI

(e.g. Jetbrains PhpStorm)

om-my-zsh aliases

ga='git add'
gl='git pull'
gp='git push'
gcam='git commit -a -m'
gcd='git checkout $(git_develop_branch)'
gdcw='git diff --cached --word-diff'
gfa='git fetch --all --prune --jobs=10'
ggpush='git push origin "$(git_current_branch)"'
gloga='git log --oneline --decorate --graph --all'
grup='git remote update'
gsps='git show --pretty=short --show-signature'
gst='git status'
gstl='git stash list'
gswd='git switch $(git_develop_branch)'

Github tips

  • Check GitHub tools (desktop and cmdline clients)
  • Search GitHub with powerfull filters (stars/topic/users/language)
  • Check Github Explore
  • Check project Issues

Advanced git

git cherry-pick lets you select a commit from a branch to apply it to another branch.
Using tags
Git has the option to tag a commit in the repository so that you find it easier or mark an app version on a commit.
git tag 1.0.0 -m 'Release 1.0.0'
Stashing your changes
git stash allows you to save the current state of the local repository and restore it later.
Creating a patch
git format-patch command is useful to transfer a commit to another repository

Best practices

…and worst

  • Don’t commit half-done work
  • Don’t change the published history
  • Never rebase a branch that has been pushed to a public repository

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional


feat: add hat wobble
^--^  ^------------^
|     |
|     +-> Summary in present tense.
+-------> Type: chore, docs, feat, fix, refactor, style, or test.

More Examples

  • feat: (new feature for the user, not a new feature for build script)
  • fix: (bug fix for the user, not a fix to a build script)
  • docs: (changes to the documentation)
  • style: (formatting, missing semi colons, etc; no production code change)
  • refactor: (refactoring production code, eg. renaming a variable)
  • test: (adding missing tests, refactoring tests; no production code change)
  • chore: (updating grunt tasks etc; no production code change)



Pro Git by Scott Chacon and Ben Straub

Git Succinctly by Ryan Hodson

Cheat Sheets


man git
git help <command>

Advanced topics