Git
Chapters ▾ 2nd Edition

10.1 Mga Panloob ng GIT - Plumbing and Porcelain

Maaari mong nalaktawan ang kabanatang ito mula sa mas naunang kabanata, o maaari kang nakarating dito pagkatapos mo basahin ng sunod sunod ang aklat hanggang sa puntong ito — sa ano mang kaso, dito tatalakayin ang mga panloob na pagtatrabaho at implementasyon ng Git. Nalaman namin na ang pag-intindi ng impormasyong ito ay mahalaga sa panimula upang mapahalagahan kung gaano kapaki-pakinabang at makapangyarihan ang Git, ngunit ang iba ay nakipagtalo sa amin na ito ay maaaring nakalilito at hindi kinakailangan kumplikado para sa mga nagsisimula. Kaya, ginawa namin ang dikusyong ito bilang huling kabanata sa aklat na ito upang mabasa mo ito nang maaga o huli sa proseso ng iyong pag-aaral. Iniwan na namin sa inyo ang pagpasya.

Ngayon na nandito ka na, simulan na natin. Una, kung hindi pa ito klaro sa iyo, ang Git sa panimula ay isang filesystem na maaaring i-address ang nilalaman at mayroong VCS na interface para sa mga gumagamit. Malalaman mo ang kahulugan nito sa ilang sandali.

Sa mga naunang araw ng Git (halos bago ang 1.5), ang interface ng gumagamit ay mas kumplikado dahil binigyang diin nito ang filesystem sa halip na pakinisin ang VCS. Sa mga nakaraang taon, ang UI ay mas pinainam hanggang sa ito ay maging malinis at madaling gamitin tulad ng anumang mga sistema; subalit, ang gasgas tungkol sa naunang Git UI na kumplikado at mahirap pag-aralan ay nanatili.

Ang nilalaman-tinumbok na filesystem na maaaring i-address ang nilalaman ay nakamamangha, kung kaya’t tatalakayin natin yan ng una sa kabanatang ito; saka, matututuhan mo ang tungkol sa mga mekanismo ng transportasyon at ang mga gawain sa pagpapanatili ng imbakan na maaari mong tingnan.

Plumbing and Porcelain

This book covers primarily how to use Git with 30 or so subcommands such as checkout, branch, remote, and so on. But because Git was initially a toolkit for a version control system rather than a full user-friendly VCS, it has a number of subcommands that do low-level work and were designed to be chained together UNIX-style or called from scripts. These commands are generally referred to as Git’s “plumbing” commands, while the more user-friendly commands are called “porcelain” commands.

As you will have noticed by now, this book’s first nine chapters deal almost exclusively with porcelain commands. But in this chapter, you’ll be dealing mostly with the lower-level plumbing commands, because they give you access to the inner workings of Git, and help demonstrate how and why Git does what it does. Many of these commands aren’t meant to be used manually on the command line, but rather to be used as building blocks for new tools and custom scripts.

When you run git init in a new or existing directory, Git creates the .git directory, which is where almost everything that Git stores and manipulates is located. If you want to back up or clone your repository, copying this single directory elsewhere gives you nearly everything you need. This entire chapter basically deals with what you can see in this directory. Here’s what a newly-initialized .git directory typically looks like:

$ ls -F1
config
description
HEAD
hooks/
info/
objects/
refs/

Depending on your version of Git, you may see some additional content there, but this is a fresh git init repository — it’s what you see by default. The description file is used only by the GitWeb program, so don’t worry about it. The config file contains your project-specific configuration options, and the info directory keeps a global exclude file for ignored patterns that you don’t want to track in a .gitignore file. The hooks directory contains your client- or server-side hook scripts, which are discussed in detail in Mga Hook ng Git.

This leaves four important entries: the HEAD and (yet to be created) index files, and the objects and refs directories. These are the core parts of Git. The objects directory stores all the content for your database, the refs directory stores pointers into commit objects in that data (branches, tags, remotes and more), the HEAD file points to the branch you currently have checked out, and the index file is where Git stores your staging area information. You’ll now look at each of these sections in detail to see how Git operates.

scroll-to-top