Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TL Localization - Chapter 7, stashing-cleaning.asc, submodules.asc (1,207 words) #77

Merged
merged 4 commits into from Feb 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
88 changes: 44 additions & 44 deletions book/07-git-tools/sections/submodules.asc
@@ -1,61 +1,61 @@
[[_git_submodules]]
=== Submodules
=== Mga Submodule

It often happens that while working on one project, you need to use another project from within it.
Perhaps it’s a library that a third party developed or that you’re developing separately and using in multiple parent projects.
A common issue arises in these scenarios: you want to be able to treat the two projects as separate yet still be able to use one from within the other.
Madalas na nangyayari na habang nagtatrabaho sa isang proyekto, kailangan mong gumamit ng isa pang proyekto mula sa loob nito.
Marahil ito ay isang library na binuo ng isang third party o ikaw ay hiwalay lumilikha at ginagamit sa maraming mga proyektong magulang.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

third party to ikatlong partido

Ang isang karaniwang isyu ay lumitaw sa mga sitwasyong ito: gusto mong tratuhin ang dalawang proyekto na hiwalay ngunit maaari pa ring magamit ang isa mula sa loob ng isa pa.

Here’s an example.
Suppose you’re developing a website and creating Atom feeds.
Instead of writing your own Atom-generating code, you decide to use a library.
You’re likely to have to either include this code from a shared library like a CPAN install or Ruby gem, or copy the source code into your own project tree.
The issue with including the library is that it’s difficult to customize the library in any way and often more difficult to deploy it, because you need to make sure every client has that library available.
The issue with copying the code into your own project is that any custom changes you make are difficult to merge when upstream changes become available.
Narito ang isang halimbawa.
Ipagpalagay na ikaw ay bumubuo ng isang website at naglilikha ng Atom feed.
Sa halip na nagsusulat ng iyong sariling code na binubuo ng Atom, napagdesisyunan mo na gumamit ng isang library.
Malamang na kailangang isama mo ang code na ito mula sa isang nakabahaging library tulad ng pag-install ng CPAN o Ruby gem, o kopyahin ang source code sa iyong sariling tree ng proyekto.
Ang isyu sa pagsasali sa library ay mahirap na ipasadya ang library sa anumang paraan at kadalasang mas mahirap na i-deploy ito, dahil kailangan mong siguraduhin na ang bawat kliyente ay may magagamit na library.
Ang isyu sa pagkokopya ng code sa iyong sariling proyekto ay mahirap na isama ang anumang mga pasadyang pagbabago na iyong ginawa kapag ang mga upstream na pagbabago ay nagiging nagagamit.

Git addresses this issue using submodules.
Submodules allow you to keep a Git repository as a subdirectory of another Git repository.
This lets you clone another repository into your project and keep your commits separate.
Tinatalakay ng Git ang mga isyung ito gamit ang mga submodule.
Ang mga submodule ay nagpapahintulot sa iyo na panatilihin ang isang repositoryo ng Git bilang isang subdirectory ng ibang repositoryo ng Git.
Pinapayagan na nito na i-clone ang iba pang repositoryo sa iyong proyekto at panatilihing hiwalay ang iyong mga commit.

[[_starting_submodules]]
==== Starting with Submodules
==== Pagsisimula sa mga Submodule

We'll walk through developing a simple project that has been split up into a main project and a few sub-projects.
Ating tatalakayin ang paggawa ng isang simpleng proyekto na hinati sa isang pangunahing proyekto at ilang mga sub-project.

Let's start by adding an existing Git repository as a submodule of the repository that we're working on.
To add a new submodule you use the `git submodule add` command with the absolute or relative URL of the project you would like to start tracking.
In this example, we'll add a library called ``DbConnector''.
Ating simulan sa pamamagitan ng pagdagdag ng isang umiiral na repositoryo ng Git bilang isang submodule na repositoryo na ating tinatrabaho.
Upang magdagdag ng isang bagong submodule, gumamit ng utos na `git submodule add` na may ganap o kaugnay na URL ng pryekto na nais mong simulang subaybayan.
Sa halimbawang ito, magdadagdag tayo ng isang library na tinatawag na ``DbConnector''.

[source,console]
----
$ git submodule add https://github.com/chaconinc/DbConnector
Cloning into 'DbConnector'...
remote: Counting objects: 11, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 11 (delta 0), reused 11 (delta 0)
Unpacking objects: 100% (11/11), done.
Checking connectivity... done.
Pagkokopya sa 'DbConnector'...
remote: Pagbibilang ng mga bagay: 11, tapos na.
remote: Pagko-compress ng mga bagay: 100% (10/10), tapos na.
remote: Kabuuan 11 (delta 0), muling nagamit 11 (delta 0)
Pag-aalis ng laman ng mga bagay: 100% (11/11), tapos na.
Pagsusuri ng pagkakakonekta... tapos na.
----

By default, submodules will add the subproject into a directory named the same as the repository, in this case ``DbConnector''.
You can add a different path at the end of the command if you want it to go elsewhere.
Bilang default, idadagdag ng mga submodule ang subprject sa isang direktoryo na pinangalanan nang pareho sa repositoryo, sa kasong ito ay ``DbConnector''.
Maaari kang magdagdag ng iba't-ibang path sa huli ng utos kung nais mo ito pumunta saanman.

If you run `git status` at this point, you'll notice a few things.
Kung patakbuhin mo ang `git status` sa puntong ito, mapapansin mo ang ilang mga bagay.

[source,console]
----
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Sa branch na master
Ang iyong branch ay napapanahon sa 'origin/master'.

Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
Ang mga pagbabagong dapat i-commit:
(gumamit ng "git reset HEAD <file>..." upang mag-unstage)

new file: .gitmodules
new file: DbConnector
bagong file: .gitmodules
bagong file: DbConnector
----

First you should notice the new `.gitmodules` file.
This is a configuration file that stores the mapping between the project’s URL and the local subdirectory you’ve pulled it into:
Una dapat mong mapansin ang bagong file na `.gitmodules`.
Ito ay isang file ng pagsasaayos na nag-iimbak sa pag-map sa pagitan ng URL ng proyekto at ang lokal na subdirectory na na-pull mo ito:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pag-map to pagmapa


[source,ini]
----
Expand All @@ -64,17 +64,17 @@ This is a configuration file that stores the mapping between the project’s URL
url = https://github.com/chaconinc/DbConnector
----

If you have multiple submodules, you’ll have multiple entries in this file.
It’s important to note that this file is version-controlled with your other files, like your `.gitignore` file.
It’s pushed and pulled with the rest of your project.
This is how other people who clone this project know where to get the submodule projects from.
Kung mayroon kang maramihang mga submodule, magkakaroon ka ng maramihang mga entry sa file na ito.
Mahalaga na tandaan na ang file na ito ay kontrolado ng bersyon kasama ang iyong ibang mga file, katulad ng iyong file na `.gitignore`.
Ito ay naka-push at naka-pull sa natitirang bahagi ng iyong proyekto.
Ito ay kung paano alam ng ibang mga tao na nag-clone ng proyektong ito kung saan makukuha ang mga proyekto ng submodule.

[NOTE]
[TANDAAN]
=====
Since the URL in the .gitmodules file is what other people will first try to clone/fetch from, make sure to use a URL that they can access if possible.
For example, if you use a different URL to push to than others would to pull from, use the one that others have access to.
You can overwrite this value locally with `git config submodule.DbConnector.url PRIVATE_URL` for your own use.
When applicable, a relative URL can be helpful.
Dahil ang URL sa file na .gitmodules ay kung ano ang unang subukan ng mga tao upang i-clone/i-fetch, siguraduhin na gumamit ng isang URL na maaari nilang ma-access kung posible.
Halimbawa, kung gumamit ka ng isang iba't ibang URL upang mag-push kaysa sa iba na gusto na mag-pull, gumamit ng isa na may access ang iba.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

access to pahintulot

Maaari mong i-overwrite ang halaga na ito nang lokal gamit ang `git config submodule.DbConnector.url PRIVATE_URL` para sa pansariling paggamit.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i-overwrite to sapawan

Kung naaangkop, maaaring makatulong ang isang kaugnay na URL.
=====

The other listing in the `git status` output is the project folder entry.
Expand Down