Inā ʻoe e hoʻohana ana iā GitHub a makemake ʻoe i ka laina kauoha e like me aʻu e hana i nā mea āpau me ka ʻole o ka pilikia ma GUI, ua ʻike paha ʻoe i ka hoʻomaka ʻana o GitHub e hoʻohana i kā lākou mea hana hou ʻole i kapa ʻia ʻo "gh". Ua hoʻoholo wau e hāʻawi i kahi pana, no ka mea, he mea hoʻohiki ma hope o nā mea a pau. A makemake nui wau iā ia - No laila makemake wau e hana i kahi ʻatikala e pili ana iā ia!
Ma mua o ka hoʻomaka ʻana, pono wau e wehewehe i kekahi mau huaʻōlelo aʻu e hoʻohana ai i kēia ʻatikala.
ʻO "GH" ke kū nei no "GitHub”. ʻO kēia kahi i puka mai ai ka inoa o ka mea hana, no laila ʻaʻole hiki ke huikau me Git ponoʻī. No ka wehewehe ʻana i kāna hana ma ka laulā, hiki iā ʻoe ke hana, ʻoki, holoi, nānā i nā repos; hana i nā noi huki; a he nui hou aku. Inā ʻaʻole hiki iā ʻoe ke ʻike i kahi hiʻohiʻona akā ʻaʻole makemake ʻoe e haʻalele i ka terminal, hāʻawi pū ia i kahi polokalamu kele pūnaewele no ʻoe e nānā i nā ʻaoʻao ma GitHub.
ʻO ka "CLI" ke kū nei no "Ckauoha Line Interface”. ʻO kēlā Terminal (a i ʻole ma Windows, Command Prompt) kekahi o lākou. Inā loaʻa kahi "CLI" i hoʻopili ʻia ma ka ʻaoʻao o kahi inoa app ("Git CLI" no kēia ʻatikala), ʻo ia ka mea e holo ana ka app ma o ka terminal wale nō. A ʻo "Git CLI" i kēia pōʻaiapili, ʻo ia ka Git a mākou i ʻike ai. E like me ke kauoha a mākou e hana ai i nā hana a i ʻole rebases me.
ʻO GUI ke kū nei no "Gʻōlelo raphical User Interface" a ʻo ia ke kikowaena a mākou e "hoʻokele" ai. ʻOi aku ka maikaʻi, ʻo kahi kaiapuni papa ma ka laulā he GUI.
ʻO "Kī API" kekahi ʻano o kahi kaula huna/faila āu e hoʻohana ai e hōʻoia i nā lawelawe. E makaʻala ʻaʻole ia e kāpae i ka hōʻoia 2 helu a pēlā aku ke hōʻoia ʻoe me ia. No laila e mālama pono iā lākou a ma kahi e hiki ʻole ai i nā ala ʻē aʻe.
ʻO ka mea mua, he aha kēia mea hana? Pehea e mālama ai i nā hana a mākou e hana ai ma o Git CLI?
Hiki ke noʻonoʻo ʻia ʻo "gh" he kumu hāmama (Source Code) e hoʻohana ana iā Git CLI ponoʻī a me nā API GitHub e hana i nā mea. ʻOiaʻiʻo, hiki iā ʻoe ke hāʻawi i nā ʻāpana i nā kauoha Git e hoʻohana ai! E komo au i ia mau mea ma hope aku.
Hoʻokomo a hoʻonohonoho
E hoʻomanaʻo e hele wau i ka hoʻonohonoho hoʻohana ʻana Termux. Akā ʻo ke kaʻina hana e like like me kāu e loaʻa ai ma kahi distro e pili ana iā Debian - aia ʻo Ubuntu ma kā lākou repos mana no ka laʻana. No Windows, pono, pono ʻoe iā CygWin a i ʻole WSL. ¯\_(ツ)_/¯
# E hoʻokomo mua i ka mea hana. Hoʻokomo pū ʻia ʻo Git ʻoiai ʻo ia ka backend # no gh. $ pkg install git gh -y # A laila ma mua o nā mea āpau, pono mākou e hōʻoia. E mālama kēia i kahi # kī API hou ma ka waihona o ka mea hana no laila ʻaʻole pono ʻoe e hōʻoia hou i #. Inā ua hoʻonohonoho mua ʻoe iā GITHUB_TOKEN, ʻaʻole e holo kēia no laila wehe ʻia # ia mua. :) $ gh auth login
I kēia manawa, ma mua o ka hoʻomau ʻana ma ʻaneʻi, pono wau e kuhikuhi i kekahi mau mea.
- mua, mai koho i ka "GitHub Enterprise Server" inā ʻaʻohe āu ʻano GitHub hoʻokipa ponoʻī iā ʻoe.
- ʻO ka lua, e hoʻohana i ka SSH ma kahi o HTTPS inā loaʻa iā ʻoe kāu kī ākea ma kāu moʻokāki GitHub. Inā nalowale ke kī API iā ʻoe, ʻaʻole e nalowale kāu kī SSH no laila hiki ke lilo ia i kumu hoʻihoʻi maikaʻi.
- ʻO ke kolu, koho i ke komo ʻana me ka polokalamu kele pūnaewele inā ʻaʻole ʻoe he kī API ma ka lima! ʻOiaʻiʻo, ʻaʻole kūpono ka loaʻa ʻana o kekahi kī ʻoiai ua loaʻa iā ʻoe kekahi.
Ke pau ʻoe i ka hoʻonohonoho ʻana, e haʻi iā Git CLI e pili ana.
$ gh auth hoʻonohonoho-git
E hana kēia i nā hoʻonohonoho Git CLI pono i ka wā e komo ai kāu reflexes a hoʻohana iā Git ma kahi o GH.
Kekahi mau kauoha kumu
I kēia manawa ua hoʻonohonoho ʻoe iā GH, e ʻae mai iaʻu e aʻo iā ʻoe i kekahi mau kauoha kumu ma kahi moʻolelo.
ʻO ka mea mua, e ʻōlelo mākou makemake ʻoe e hana i kahi noi huki i kaʻu repo manifests kūloko. Makemake ʻoe e ʻoki mua.
$ gh repo fork windowz414/platform_manifest ! Ua loaʻa ʻo windowz414/platform_manifest? Makemake ʻoe e clone i ka ʻōpala? ʻAe Cloning i loko o 'platform_manifest'... mamao: E helu ana i nā mea: 136, pau. mamao: Ka helu ʻana i nā mea: 100% (136/136), pau. mamao: Hoʻopili i nā mea: 100% (81/81), hana. mamao: Huina 136 (delta 46), hoʻohana hou ʻia 89 (delta 12), hoʻohana hou ʻia 0 Loaʻa nā mea: 100% (136/136), 30.70 KiB | 166.00 KiB/s, pau. Hoʻoholo i nā deltas: 100% (46/46), pau. Hoʻohou i luna mai github.com:windowz414/platform_manifest * [lālā hou] amyrom/rosie -> upstream/amyrom/rosie * [lālā hou] aosp-ʻumikūmākahi -> upstream/aosp-ʻumikūmākahi * [lālā hou] aosp-ʻumi -> upstream/aosp-ten * [lala hou] arrow-11.0 -> upstream/arrow-11.0 * [lala hou] cm-14.1 -> upstream/cm-14.1 * [lala hou] dot11 -> upstream/dot11 * [ lala hou ] e/os/v1-nougat -> upstream/e/os/v1-nougat * [lala hou] wai-11 -> upstream/fluid-11 * [lala hou] fox_7.1 -> upstream/fox_7.1 * [lala hou] hentai-rika -> upstream/hentai-rika * [new branch] ion-pie -> upstream/ion-pie * [new branch] lineage-15.1 -> upstream/lineage-15.1 * [new branch] lineage -17.1 -> upstream/lineage-17.1 * [new branch] lineage-18.1 -> upstream/lineage-18.1 * [new branch] lineage-18.1_teos -> upstream/lineage-18.1_teos * [new branch] lineage-19.0 - > upstream/lineage-19.0 * [new branch] main -> upstream/main * [new branch] mkn-mr1 -> upstream/mkn-mr1 * [new branch] revengeos-r11.0 -> upstream/revengeos-r11.0. 1 * [lala hou] stellar-S1 -> upstream/stellar-S11 * [new branch] teos-n -> upstream/teos-n * [new branch] weebprojekt-11 -> upstream/weebprojekt-XNUMX ✓ Cloned fork
A laila e ʻōlelo mākou he hui ʻokoʻa kāu no kāu mau hoʻokolohua i kapa ʻia ʻo "wz414-labs", ʻaʻole ʻoe i ʻoki i kāu ʻaoʻao pilikino a makemake ʻoe e clone ma laila a laila wehe i ka noi huki ma laila. Makemake ʻoe e clone i ka lālā "cm-14.1" no laila ʻaʻole pono ʻoe e hana hou i ka git-checkout.
$ gh repo fork windowz414/platform_manifest --org="wz414-labs" -- --branch="cm-14.1" ✓ Hana ʻia ka lāʻau wz414-labs/platform_manifest ? Makemake ʻoe e clone i ka ʻōpala? ʻAe Cloning i loko o 'platform_manifest'... mamao: E helu ana i nā mea: 136, pau. mamao: Ka helu ʻana i nā mea: 100% (136/136), pau. mamao: Hoʻopili i nā mea: 100% (81/81), hana. mamao: Huina 136 (delta 46), hoʻohana hou ʻia 89 (delta 12), hoʻohana hou ʻia 0 Loaʻa nā mea: 100% (136/136), 30.70 KiB | 120.00 KiB/s, pau. Hoʻoholo i nā deltas: 100% (46/46), pau. Hoʻohou i luna mai github.com:windowz414/platform_manifest * [lālā hou] amyrom/rosie -> upstream/amyrom/rosie * [lālā hou] aosp-ʻumikūmākahi -> upstream/aosp-ʻumikūmākahi * [lālā hou] aosp-ʻumi -> upstream/aosp-ten * [lala hou] arrow-11.0 -> upstream/arrow-11.0 * [lala hou] cm-14.1 -> upstream/cm-14.1 * [lala hou] dot11 -> upstream/dot11 * [ lala hou ] e/os/v1-nougat -> upstream/e/os/v1-nougat * [lala hou] wai-11 -> upstream/fluid-11 * [lala hou] fox_7.1 -> upstream/fox_7.1 * [lala hou] hentai-rika -> upstream/hentai-rika * [new branch] ion-pie -> upstream/ion-pie * [new branch] lineage-15.1 -> upstream/lineage-15.1 * [new branch] lineage -17.1 -> upstream/lineage-17.1 * [new branch] lineage-18.1 -> upstream/lineage-18.1 * [new branch] lineage-18.1_teos -> upstream/lineage-18.1_teos * [new branch] lineage-19.0 - > upstream/lineage-19.0 * [new branch] main -> upstream/main * [new branch] mkn-mr1 -> upstream/mkn-mr1 * [new branch] revengeos-r11.0 -> upstream/revengeos-r11.0. 1 * [lala hou] stellar-S1 -> upstream/stellar-S11 * [new branch] teos-n -> upstream/teos-n * [new branch] weebprojekt-11 -> upstream/weebprojekt-XNUMX ✓ Cloned fork
ʻIke ʻoe ʻaʻole wau i hoʻohana i ka "-b cm-14.1" a hana i ka hoʻopaʻapaʻa lōʻihi. E like me ka lā o kēia ʻatikala, ʻo Pepeluali 16, 2022, loaʻa iā GH kahi pōpoki ʻaʻole ia e hāʻawi pololei i nā hoʻopaʻapaʻa pōkole iā Git CLI a no laila pono e hana ʻia e like me nā hoʻopaʻapaʻa lōʻihi.
Ke pau ia, ua komo mau ʻoe i ka waihona, hana i kāu mau hoʻololi, hoʻokō a hoʻopaʻa ʻia, a mākaukau e hana i ka noi huki. No kēia, he mea maʻalahi wale kāu e pono ai
$ gh pr hana --branch="cm-14.1" Ke hana nei i ka noi huki no wz414-labs:cm-14.1 i ka cm-14.1 ma windowz414/platform_manifest? Title teos: Hoʻololi i Git-Polycule ? Kino ? He aha ka hope? Hoʻouna https://github.com/windowz414/platform_manifest/pull/1
Inā ʻaʻole ʻoe e hoʻopili i ka "–branch=cm-14.1", e hana ana ʻoe i ka PR i ka lālā "nui", ʻo ia ka mea e hoʻopilikia ai ke mālama ʻole ʻia.
A i kēia manawa, pono wau e hoʻohui i kēia PR, ʻeā? No laila, hoʻopili mua wau i ka repo, nānā i ka lālā i hāʻawi ʻia, a papa inoa mua i nā PR.
# Hoʻopili mua. $ git clone https://github.com/windowz414/platform_manifest Hoʻopili i ka 'platform_manifest'... mamao: Ka helu ʻana i nā mea: 136, pau. mamao: Ka helu ʻana i nā mea: 100% (136/136), pau. mamao: Hoʻopili i nā mea: 100% (81/81), hana. mamao: Huina 136 (delta 46), hoʻohana hou ʻia 89 (delta 12), hoʻohana hou ʻia 0 Loaʻa nā mea: 100% (136/136), 30.70 KiB | 137.00 KiB/s, pau. Hoʻoholo i nā deltas: 100% (46/46), pau. # A laila e nānā i ka lālā. $ git checkout cm-14.1 lālā 'cm-14.1' i hoʻonohonoho ʻia e hahai i ka 'kumu / cm-14.1'. Ua hoʻololi ʻia i kahi lālā hou 'cm-14.1' # A i kēia manawa e hoʻopaʻa inoa i nā PR. $ gh pr papa inoa E hōʻike ana i 1 o 1 wehe noi huki ma windowz414/platform_manifest #1 teos: Hoʻololi iā Git-Polycule wz414-labs:cm-14.1
I kēia manawa ke ʻike nei mākou aia kahi PR e hoʻololi i kahi mamao i "Git-Polycule", e ʻike kākou i ka mea i loli me ia.
$ gh pr diff 1 diff --git a/teos.xml b/teos.xml index b145fc0..3aadeb6 100644 --- a/teos.xml +++ b/teos.xml @@ -2,7 +2,7, 414 @@
Me he mea lā e hoʻohiki! ʻO ka manawa e hui ai!
$ gh pr merge 1 ? He aha ke ala hoʻohui āu e makemake ai e hoʻohana? Hoʻokumu hou a hoʻohui ? He aha ka hope? E hoʻouna i ✓ noi huki hou a hui ʻia #1 (teos: Hoʻololi iā Git-Polycule)
I kēia manawa ua hoʻohui au iā ia, hiki iā ʻoe ke holoi i kāu ʻōpala.
$ gh repo holoi --hōʻoia wz414-labs/platform_manifest ✓ Holoi ʻia kahi waihona wz414-labs/platform_manifest
ʻIke ʻoe ua hoʻopau pololei i ka repo me ka ʻole o ka noi hōʻoia no ka mea ua hala wau i ka "-confirm" parameter ma laila. Inā ʻaʻole ʻoe e hele, e loaʻa iā ʻoe kēia:
$ gh repo e holoi i ka windowz414/systemd? E kaomi i ka windowz414/systemd e hōʻoia i ka holoi ʻana:
A pono ʻoe e kākau i ka inoa repo holoʻokoʻa. Hoʻopau manawa…
hōʻuluʻulu manaʻo
ʻO ka waiho wale ʻana, ʻo `gh` kahi mea maʻalahi ʻo Git CLI/Curl wrapper e hoʻohui i nā hana Git maʻalahi a me nā mea GitHub API ma lalo o ka hale hoʻokahi. Pehea ʻoe e hoʻohana ai? He mea hoʻohiki ia iā ʻoe e like me ia iaʻu? Ke kali nei i ka lohe mai iā ʻoe!