I went today to a Git/GitHub training organized by Canoo and lead by Tim Berglund ( The online training presentation is available at use first left key then left/right/up and bottom keys to navigate through the slides.

My notes are still under reviews, but are available at

GitHub also offers free, short, topical online classes about GitHub, Git and the union of these two technologies Here.

GIT training

  • Tim Berglund
  • config
    • global
      • user level config for logged in user
    • local
      • use when pushing to github later
    • system
      • apply to every user logged in on the machine
    • Git autodetect file type
      • binary
      • text
        • CRLF

          • dont mess with it if it is working

          Colorize console output for legibility
          git config --global color.ui auto

          Force files to be LF in the repo, even on Mac/Linux
          git config --global core.autocrlf input

          Force Windows to convert to CRLF
          # on checkout and to LF on `add`
          git config --global core.autocrlf true

    • Git Help
      • git help config
        • To print and read
  • 1. Staging area
    • first add
      • git init newproject
      • cd newproject
      • vi caesar.txt
      • git status
        • file red
          • untracked
          • modified
      • git add caesar.txt
        • file green = tracked
        • it is now in staging
      • refs are name for objects
        • ex master
      • modifiy the file
        • vi caesar.txt
      • file has to go to staging before being committed
        • git add caesar.txt
          • go in staging
          • when in staging the file has no refs
        • git commit -m "small change"
          • now has a name associated to it
    • Why
      • so you can work on paralell files or topics
        • is it not a bad sign?
      • you can also commit then later "part" of the file
        • you could break easily since unit test may be broken with half file
      • advance command
        • revert
          • not like subversion
        • cherry pick
        • only if you know what it is in your stagign area
  • 4. Branching
    • HEAD
      • equals to most recent commit
      • is going to be the parent of the next commit
      • it is where the branch live
      • master is just another branch
      • a branch is at least 2 commit with the same parent
    • branch is fast because it is local
    • Play
      • create a branch
        • git branch feature
        • this do not switch to the branch
      • move to branch
        • git checkout feature

          check where you are working

          • git branch
          • git status

          vi caesar.txt

          git add caesar.txt

          git commit -m "add a title"

          git lg

      • merge feature to master
        • git checkout master
        • git merge feature
        • and kill that branch
          • better not used it if its a feature
    • git reset
      • if we discover an error in commit message 259a4c9
      • hard
        • reset both master and any branch
          • like merge has never happen
          • blow up old commit and create new ons!
          • dangerous you can lose code
      • Play
        • git reset --hard 259a4c9
        • git commit --amend
          • commits are lost
            • you can not find it
            • still there as an object but has no refs!
            • you have to remember the hash
            • may be garbage collected after 60 days
            • git reflog
              • may be still in there
        • you can then redo a git merge feature
      • better use rebase
        • 95% of git users dont know how
        • quite advanced
    • git branch adopted 259a4c9
      • create a branch adopted of the amended commit
    • delete the branch
      • git branch -d feature
        • delete the label of the branch
        • but the commit stay of course
      • git branch -d adopted
        • will complains as not merged
        • force the delete of non merged
        • git branch -D adopted
  • 5. merge conflict
    • GIT search for chunk that are similar and can merged automatically
    • Play
      • git merge feature
      • git status
        • show merge conflict
    • if you know what is in reflog
      • git reset --hard HEAD@{1}
      • you can undo last command
      • not always 1 command lead to only one entry in reflog
      • use with precaution
    • external merge tool
      • p4merge
        • config
          • git config --global merge.tool p4merge
          • git config --global mergetool.prompt false
          • git config --global mergetool.keepBackup false
          • git config --global mergetool.keepTemporaries false
        • use
          • git mergetool
    • to solve merge conflict on binary file
      • automatic merge not possible
      • you can decide your or theirs is the right one
      • git checkout --theirs -- animated.gif
        • git add animated.gif
          • git commit -m "use their version of binary animated.gif"
  • 7. GitHub
    • git remote add origin https://xxxxx/yyyy.git
      • create a local config at .git/config
      • origin is a convention name
    • git push
      • push unique content to remote
      • git push -u origin master
        • -u to make master

          remember that it

          track remote origin

      • git branch -a
        • now display also remote branch in red
    • git help daemon
      • share

        to start a git server

        to server your local

        git repo as a remote

        for colleagues

    • git help bundle
      • no network?

        write objects and refs into files

        for sharing on cdrom or

        shared drive

        for highla secure environment

        without network: ex military

    • git fetch
      • get all objects, blobs and commit

        but do not change master

        • just get and save commits

          in local remote area (read only)

          git checkout feature5

          • feature5 being in remote origin
          • will create a local branch feature5
    • git pull
      • do a git fetch and merge into master
    • git push
      • need no parameter but use push.default if it exist
      • every local branch will be pushed as default if none have been specified
      • use
        • git config --global push.default simple
          • to only push the branch where you have
          • set it if you dont know te default
        • git help config
          • upstream
          • simple
          • ...
      • when pushing failed
        • failed to push some refs upstream

          because there is a new commit

          in master which is ahead of mine

          fast forwards will work

          only if i have new stuff

          • git pull (make a merge)

            git push

            better would have been to

            make a rebase also to clear

            the noise of merging to push

    • Fun
  • 9. Collaborating
    • Play
      • git config --global credential.helper cache

        • work only in linux/mac

        vi cedric.txt

        git add .

        git commit -m "add file"

        git push

        • if not succed do a git pull

        gitk --all

        • see a lot of noise because

          of merge done by pull before

          each push

        force to rebase on pull is a

        good idea to remove noise

        • git config --local branch.master.rebase true
        • or better
          • git config --global branch.autosetuprebase always

    • tags
      • 3 differents

        • reference
          • git tag XXXXX hash
            • it is a reference
            • always point to commit
        • annotated
          • -a --annotate Make an unsigned, annotated tag object
          • git tag -a ANNOTATED_TAG
          • is an indirection to a tag
        • ...

        tags are not pushed

        by default to origin

        • git push
          • do nothing
        • git push origin ANNOTATED_TAG
          • push a specific tag
        • git push --tags
          • push all tags


        • a tag
          • git tag -d tagname
        • a branch
          • git push --delete origin branchname
          • git push origin :branchname
  • revealJS
  • filesystem
    • Hooks
      • entry point to hook
    • refs
    • objects
    • HEAD
      • commit youre on
  • 2. Log history
    • # git log
    • hash
      • 40 character hash
    • git log --format= email
    • git log --format=raw
      • useful for training
      • relationship tree -> parent -> author -> committer
        • it is a graph
          • important to understand
        • git log --graph
        • git log --graph --decorate --format=oneline
          • still a lot of hash
        • git log --graph --decorate --format=oneline --abbrev-commit
    • git log --patch
      • Show all history with patches
    • aliases
      • git lol
        • git config --global "log --graph --decorate --oneline --all"

          • like a puppet for developer
      • git lg
        • git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"

  • 3. Diff
    • git diff
    • git diff --staged
      • what is my next commit will do?
    • git diff --word-diff
    • git diff HEAD
      • show changes between local and something in history
    • create scripts
      • ~/scripts/git-xxxxxx
      • ~/scripts/git-log
    • git log ec7674 -1 --patch
      • to look at a particular commit and its diff
    • git show ec7674
  • 4. move and rename
    • remove a file from VCS and keep local copy
      • git rm --cached -- <filename>
      • git commit -m "remove from vcs"
    • GIT integrity check
      • each commit contains at least one tree and one or more blobs
      • content is king
      • blobs
        • store file content
        • no permissions
        • no metadata
        • each blob is stored under first 2 character of hash directory in /objects
        • every change of a file create a NEW blob
          • diff is calculating the diff on demand

            not storing them like svn

      • tree
        • contains file name
        • references to one or many blobs
        • one to n tree in a commit
      • git pack
        • all commits can get packed to find similar blob
        • 5 to 10 times less space than SVN
      • git GC
        • find all commits, trees and blobs

          that can not be accessed and remove them

    • git add -u .
      • update only tracked file not moved/renamed  file
      • use instead
        • git add -A .
    • git checkout -- file3.txt
      • revert file content
    • similarity content analyser
      • if more then 50% then it count the the file as renamed otherwise it is new
      • git log -2 --stat
        • may show delete + add for a move operations
      • git log -2 --stat -M
        • display also similarity index
        • may show move correctly
        • git log -2 --stat -M90
          • with 90% similarity threashold
        • git log -2 --stat -M -- file3.txt
          • limit to file
        • git log -2 --stat -M --follow -- file3.txt
          • changes + move + create
  • 6. Rebase
    • interactive rebase
    • rewrite the history
      • changing authors or any other properties
    • preparation for merging
      • Rebase Rebase Fastforward
        • ex: to make my code changes in branch

          appear like a continuation of master

          • d19' = d19
          • e69' = e69
          • but still different commits!

          do it in branch

          you want to move

          • git rebase master
            • change shape of the graph

              keep timestamp and author

              pull of all commits of a branch &

              replay all commit in master

              • may create small conflicts

          make the history straightforward

          • especially if you have a lot of branches
            • otherwise look like a train station
          • but you hide informations
            • from which branch it was merged
      • non fastforward
      • history
        • is a graph not a list like in "git log"
        • it is not temporal but topological
    • interactive rebase
      • to group commits into one
        • "commits are stories not just checkpoints"
      • git rebase -i [start, end]
        • start = HEAD as default
        • end = hash
        • git rebase -i HEAD^
          • parent of head
          • you can combine HEAD^^^^^^
        • git rebase -i HEAD~10
          • last 10 commit
        • git rev-parse HEAD^
          • give hash
        • git help gitrevisions
          • adavnce list of expressions
        • create a file so you can decide what to do
          • has command
          • pick, reword, edit,squash, fixup and exec
          • you can not squash the oldest commit
  • 8. Forking
    • Play
      • git clone xxxx
      • vi xxxxx.txt
      • git add .
      • git commit -m ""
      • git push
      • open a pull request
    • pull request
      • invitation to start a conversation
      • add metadata
        • screenshots
      • is an iterative process
        • threaded discussion
    • ideas
      • when opening  a feature branch
        • create a pull request immediately
        • improve communication and awareness and start discussion
        • even if there is no code yet done
    • merge conflict can not be solved in github
      • has to be done in command line
comments powered by Disqus

You might like also

Explore 142 Initial Exchange Offering  (IEO) by category, year and country
IEO is currently the most popular fundraising trend in the crypto industry. As the name suggests, Initial Exchange Offering is conducted over the crypto trading platform and exchanges. So unlike ICOs wherein crypto projects directly approach investors, IEOs involve a third-party in the form of crypto exchanges. An IEO is basically an ICO except that it is launched and managed by an existing exchange instead of the organization that created the token. The exchange holds and sells the token on …
46 Days ago
Security Token Offering (STO) statistics
Security token offering (STO) is a type of fundraising that is performed with a company offering tokenized securities. The defining feature of security token offerings is in its definition. Stocks, bonds and managed property trusts are another examples of securities. Essentially, a security token is a cryptocurrency-based asset that derives its value from some other asset that it represents. For example, security tokens can represent real estate or gold but, most importantly, they can represent shares and securities or their alternative. The tokens …
47 Days ago
systematization of knowledge within major blockchain protocols or consensus
Alexis Gauba presented a systematization of knowledge within major blockchain protocols or consensus, addresses the common challenges, economic model and solutions and provides a formal structure within which to compare them in this keynote presentation at Hyperledger Global Forum. …
125 Days ago
Stablecoins: Crypto's Holy Grail or Fools’ Errand? by Dr Garrick Hileman
I was attending the interesting LECTURE "Stablecoins: Crypto's Holy Grail or Fools’ Errand?" by Dr Garrick Hileman - Head of reseach at Blockchain - London School of Economics - United Kingdom at hashtagETH hashtagZurich and here is a copy of the slides Introducing: 2019 State of Stablecoins The 2019 report builds on its predecessor to provide an updated and expanded look at the current state of the stablecoin market - a space where we expect to see significant innovation in …
125 Days ago
The State of Stablecoins 2019: Hype vs. Reality in the Race for Stable, Global, Digital Money
The report, entitled “The State of Stablecoins 2019: Hype vs. Reality in the Race for Stable, Global, Digital Money” is based on information collected from 40 crypto and stablecoin firms. The report’s lead author is George Samman, a blockchain and cryptocurrency advisor. According to the document, Samman “was commissioned to research the stablecoin landscape and then independently report his findings for the broader industry to learn from.”      …
125 Days ago
The last 6 months of ICO have been imported and can be browse at I display there historical ICO data for all cryptocurrencies friendly countries for each month of the year. What you can get out of all these charts: You can see the number of ICO per months over 13 major countries (Cayman-Islands, UK, USA, Cyprus, Estonia, France, Germany, Liechtenstein, Malta, Russia, Singapore, Slovenia, Switzerland), Each country has its own color, how often that color appear on the map represents the …
125 Days ago
Consensus algorithms enable network participants to agree on the contents of a blockchain in a distributed and trust-less manner. I’ve listed in the past few months all of them at and thought it will be cool also to produce an Infographics The PNG (4528 x 2894 px, 2.5MB) can be downloaded here and the PDF version (280kb) with clickable consensus links here …
125 Days ago
No Thumbnail was found
Usually, a percentage of the tokens is sold to ICO participants and a percentage kept for the company’s needs. The token distribution and allocation of the token is usually a chapter in the future company whitepaper. A pie chart displays how and to whom tokens will be allocated. But how much tokens are allocated (amount) and what are they used for? how much token should I spend for advisor? is 15% of all tokens too much for founder? How many …
317 Days ago
No Thumbnail was found
introduction This is my attempt to list all possible blockchain consensus out there, I welcome pull request of the blockchain community! let's make it the main reference for blockchain consensus. Visit also to keep track of new developments in the distributed ledger technology space. Blockchain Consensus? At the core of the Blockchain disruption is a consensus algorithm: Consensus algorithms enable network participants to agree on the contents of a blockchain in a distributed and trust-less manner. “Consensus decision-making is a group …
328 Days ago
Initial Coin Offering security checklist
Blockchain technology and cryptocurrencies have revolutionized the way companies raise capital but at the same time are bringing their own sets of challenges. To ensure that your startup will go through that (ad)venture in a safe manner, you should always adhere to best security practices, for your company AND your investors.  This mind map will present you in a visual way lots of valuable information like: A compilation of the most dangerous threats to the ICO industry and how to mitigate, …
349 Days ago