Mastering Git: A Comprehensive Guide to Version Control System

lecture 12 plumbing and porcelain lecture n.w
1 / 10
Embed
Share

Discover the intricacies of Git version control system with this comprehensive guide covering plumbing, porcelain, object database, adding files, updating index, committing changes, moving branches, and managing packfiles effectively. Learn key commands and processes to efficiently navigate through different stages in your Git repository.

  • Git
  • Version Control
  • Object Database
  • Committing Changes
  • Branch Management

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Lecture 12: Plumbing and Porcelain Lecture 12: Plumbing and Porcelain

  2. Schedule Today (11/28): Plumbing and Porcelain Last Class (12/5): Final Exam

  3. The .git Folder $ ls .git config local configuration (not --global) description HEAD the head hooks/ scripts that run on various events info/ staging area metadata objects/ content database refs/ branches, tags, remotes

  4. Object Database Key-value data store addressable by SHA-1 hash This is my file Database (.git/objects) hash

  5. Adding Files to Object Database $ git hash-object -w <filename> Adds object to database and returns SHA-1 hash of file + header $ git cat-file -p <hash> Pretty-prints an object in the database Objects live in .git/objects: $ find .git/objects -type f .git/objects/7d/b4ad2eaea38d5714120aa20bac869ed69de756 .git/objects/c6/1a4dbe8af3b1a3c3338367fce1be14596fe80e

  6. Update Index $ git update-index --add --cacheinfo 100644 \ <hash> <filename> Add object from database to index $ git write-tree Creates tree object and returns hash

  7. Committing $ git commit-tree <tree hash> -p <parent commit hash> \ -m "message" Creates a commit with the given tree and parent Returns commit hash Does not move any refs! Now we can do: $ git log <commit hash>

  8. Refs and Moving Branches $ git update-ref refs/heads/<branch name> <commit hash> Moves branch to point to different commit $ git symbolic-ref HEAD refs/heads/<branch name> Moves the HEAD Remote refs live in refs/remotes/<remote name>/<branch name>

  9. Packfiles List size of object directory $ du -sh .git/objects List sizes of each object $ find .git/objects -type f | xargs du -h Run garbage collection and packing $ git gc List contents of packfile $ git verify-pack -v <path to pack>

  10. Data Recovery $ git reflog Lists any changes to refs in reverse-chronological order

Related


More Related Content