Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Advanced Git

Advanced Git

Advanced Git

satya sudheer

April 17, 2018
Tweet

More Decks by satya sudheer

Other Decks in Technology

Transcript

  1. HOW DOES GIT STORE INFORMATION? At its core, git is

    like a key value store. The Value (BLOB) = Data The Key (SHA1) = Hash of the Data

  2. WHERE DOES GIT STORE ITS DATA? blobs are stored in

    objects filenames & directory structures are stored in tree commit points to a tree & contains metadata like author, date, message & parent commit. references points to commits; tags, branches, head. .git directory contains data about our repository
  3. Optimisations: PACKFILES, DELTAS Git objects are compressed, further optimises by

    compressing these files together, into a Packfile. The Packfile stores the object, and deltas, or the differences between one version of the file and the next. Packfiles are generated when: you have too many objects, during gc, or during a push to a remote
  4. Three Areas Where Code Lives The Working Area The Staging

    Area (a.k.a Index, Cache) The Repository Working Area Staging Area Repo
  5. Moving In/Out of Staging Area add a file to the

    next commit delete a file in the next commit rename a file in next commit add content interactively unstage files Working Area Staging Area git add git checkout
  6. Moving content around.. 9 commit the staged snapshot commit a

    snapshot from working area to repo bringing content from repo to working area
  7. The command line is the only place you can run

    all Git commands – most of the GUIs implement only a partial subset of Git functionality for simplicity. 10
  8. Initialising a new repository: git init Cloning an existing repository:

    git clone Saving changes to the repository: git add and git commit Inspecting a repository: git status, git log Repo-to-repo collaboration: git remote, git fetch, git pull, git push Switching between: git branch, git checkout Moving content across: git stash, git merge, git rebase, git cherry-pick Configuration & set up: git config