He ngawari ki te whakamahi taputapu raina whakahau a GitHub: "gh"!

Mena kei te whakamahi koe i a GitHub me te hiahia ki te raina whakahau penei i ahau ki te mahi i nga mea katoa kaore he raruraru i runga i te GUI, kua kite pea koe me pehea te tiimata a GitHub ki te whakamahi i a raatau taputapu hou-hou e kiia nei ko "gh". I whakatau ahau ki te whakamatau, na te mea he pai te ahua. A i tino pai ahau ki a ia - Na te mea i hiahia ahau ki te hanga tuhinga mo taua mea!

I mua i te tiimata, me whakamarama e au etahi kupu ka whakamahia e au i tenei tuhinga.

"GH" e tu ana mo "GitHub”. Koinei te take i ahu mai ai te ingoa o te taputapu, na reira kaore e taea te pohehe ki a Git ano. Hei whakamarama he aha tana mahi i te nuinga, ka taea e koe te hanga, te marau, te muku, te tirotiro repo; hanga tono kume; me te tini ke atu. Mena karekau koe e kite i tetahi ahuatanga engari kaore koe e hiahia ki te wehe i te tauranga, ka tukuna ano he kaitirotiro tuhinga-tuhi hei tirotiro i nga wharangi o GitHub.

"CLI" e tu ana mo "Ctono LIne Iatanga”. Ko taua Terminal (kei Windows ranei, Whakatairanga Whakatairanga) tetahi o era. Mena he "CLI" kua apitihia ki te taha o tetahi ingoa taupānga ("Git CLI" mo tenei tuhinga), ko te tikanga ka rere te taupānga ma te tauranga anake. A ko "Git CLI" i roto i tenei horopaki, ko te Git e mohio ana tatou. Pērā i te whakahau ka mahia e matou ka mahi, ka whakahoki ano ranei.

Ko te GUI te tohu "Gwhakapapa Uhei Interface” a koinei te atanga ka “whakatere” tatou. He pai ake te korero, ko te taiao papamahi he GUI.

Ko te "Kī API" he momo aho/kōnae huna e whakamahia ana e koe hei whakamotuhēhē ki ngā ratonga. Kia tupato kei takahia e ia te whakamotuhēhēnga take e 2 me etahi atu ina whakamotuhēhēhia e koe. No reira kia noho haumaru me te waahi karekau e taea e etahi atu huarahi.

Tuatahi, he aha tenei taputapu? Me pehea te whakahaere i nga mahi ka mahia ma te Git CLI?

"gh" ka taea te whakaaro hei puna tuwhera (Waehere pūtake) te takai e whakamahi ana i a Git CLI ake me nga API GitHub hei whakatutuki i nga mahi. Inaa, ka taea e koe te tuku tawhā ki nga whakahau Git e whakamahia ana e ia! Ka uru atu ahau ki era i muri mai.

Te whakauru me te whakarite

Kia maumahara ka haere ahau ki te whakaurunga ma te whakamahi Termux. Engari ko te tikanga kia rite tonu ki a koe i runga i te Debian-based distro - Kei a Ubuntu i runga i o raatau repo mana hei tauira. Mo Windows, me hiahia koe ki a CygWin, WSL ranei. ¯\_(ツ)_/¯

# Me whakauru i te taputapu tuatahi. Kei te whakauru ano i a Git na te mea ko te tuara # mo te gh. $ pkg tāuta git gh -y # Na i mua i nga mea katoa, me whakamotuhēhē. Ma tenei ka tiakina he # matua API hou i runga i te papaa raraunga o te taputapu kia kore koe e hiahia ki te whakamotuhēhē # anō. Mēnā kua tautuhi kē koe i a GITHUB_TOKEN, karekau tēnei e pai kia whakakorea # te tuatahi. :) $ gh te takiuru mana

Na, i mua i te haere tonu ki konei, me whakaatu e au etahi mea.

  • Tuatahi, kaua e whiriwhiri i te "GitHub Enterprise Server" mena karekau he momo GitHub e manaaki ana koe.
  • Tuarua, whakamahia te SSH hei utu mo te HTTPS mena ka taapirihia to taviri whanui ki to putea GitHub. Mena ka ngaro koe i te kii API, kaore koe e ngaro i to taviri SSH kia pai ai te tikanga whakamuri.
  • Tuatoru, whiriwhiria te takiuru me te kaitirotiro mena karekau he taviri API kei o ringaringa! Ae, karekau he tikanga ki te whai i tetahi atu ki te mea kei a koe ano tetahi.

Ka oti ana koe ki te whakarite, me korero atu ki a Git CLI.

$ gh auth setup-git

Ma tenei ka hanga nga whirihoranga Git CLI e tika ana mena ka uru mai o whakaata ki roto ka whakamahi koe i te Git hei utu mo te GH.

Ko etahi whakahau taketake

Inaianei kua whakatauhia e koe te GH, me ako koe ki etahi whakahau taketake i roto i te kaupapa korero.

Tuatahi, me kii e hiahia ana koe ki te hanga tono kume ki taku repo whakaaturanga o te rohe. E hiahia ana koe ki te marau i te tuatahi.

$ gh repo marau windowz414/platform_manifest ! windowz414/platform_manifest kei te noho tonu? Kei te pirangi koe ki te whakakao i te marau? Ae Te Whakatau ki te 'platform_manifest'... mamao: Tatau ahanoa: 136, kua oti. mamao: Tatau taonga: 100% (136/136), kua oti. mamao: Kōpeke ahanoa: 100% (81/81), oti. mamao: Tapeke 136 (delta 46), whakamahia ano 89 (delta 12), kete-whakamahia ano 0 Te whiwhi taonga: 100% (136/136), 30.70 KiB | 166.00 KiB/s, kua oti. Te whakatau i nga waahanga: 100% (46/46), kua oti. Whakahoutanga whakarunga Mai i github.com:windowz414/platform_manifest * [manga hou] amyrom/rosie -> whakarunga/amyrom/rosie * [manga hou] aosp-tekau ma tahi -> whakarunga/aosp-tekau ma tahi * [manga hou] aosp-tekau -> whakarunga/aosp-tekau * [manga hou] pere-11.0 -> whakarunga/pere-11.0 * [manga hou] cm-14.1 -> whakarunga/cm-14.1 * [manga hou] dot11 -> whakarunga/dot11 * [manga hou ] e/os/v1-nougat -> upstream/e/os/v1-nougat * [manga hou] fluid-11 -> upstream/fluid-11 * [manga hou] fox_7.1 -> upstream/fox_7.1 * [manga hou] hentai-rika -> whakarunga/hentai-rika * [manga hou] poroi katote -> upstream/ion-pie * [manga hou] whakapapa-15.1 -> upstream/lineage-15.1 * [manga hou] whakapapa -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 * [manga hou] matua -> upstream/main * [manga hou] mkn-mr1 -> upstream/mkn-mr1 * [manga hou] revengeos-r11.0 -> upstream/revengeos-r11.0. 1 * [manga hou] whetū-S1 -> whakarunga/whetu-S11 * [manga hou] teos-n -> whakarunga/teos-n * [manga hou] weebprojekt-11 -> whakarunga/weebprojekt-XNUMX ✓ Marau kano

Kaati me kii he whakahaere motuhake koe mo o whakamatautau e kiia nei ko "wz414-labs", kaore ano koe i marau i runga i to korero whaiaro ka hiahia koe ki te kati ki reira ka whakatuwherahia te tono kume ki reira. Kei te pirangi ano koe ki te kati i te peka “cm-14.1” kia kore ai koe e mahi git-checkout ki reira.

$ gh repo marau windowz414/platform_manifest --org="wz414-labs" -- --branch="cm-14.1" ✓ Hangaia te marau wz414-labs/platform_manifest ? Kei te pirangi koe ki te whakakao i te marau? Ae Te Whakatau ki te 'platform_manifest'... mamao: Tatau ahanoa: 136, kua oti. mamao: Tatau taonga: 100% (136/136), kua oti. mamao: Kōpeke ahanoa: 100% (81/81), oti. mamao: Tapeke 136 (delta 46), whakamahia ano 89 (delta 12), kete-whakamahia ano 0 Te whiwhi taonga: 100% (136/136), 30.70 KiB | 120.00 KiB/s, kua oti. Te whakatau i nga waahanga: 100% (46/46), kua oti. Whakahoutanga whakarunga Mai i github.com:windowz414/platform_manifest * [manga hou] amyrom/rosie -> whakarunga/amyrom/rosie * [manga hou] aosp-tekau ma tahi -> whakarunga/aosp-tekau ma tahi * [manga hou] aosp-tekau -> whakarunga/aosp-tekau * [manga hou] pere-11.0 -> whakarunga/pere-11.0 * [manga hou] cm-14.1 -> whakarunga/cm-14.1 * [manga hou] dot11 -> whakarunga/dot11 * [manga hou ] e/os/v1-nougat -> upstream/e/os/v1-nougat * [manga hou] fluid-11 -> upstream/fluid-11 * [manga hou] fox_7.1 -> upstream/fox_7.1 * [manga hou] hentai-rika -> whakarunga/hentai-rika * [manga hou] poroi katote -> upstream/ion-pie * [manga hou] whakapapa-15.1 -> upstream/lineage-15.1 * [manga hou] whakapapa -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 * [manga hou] matua -> upstream/main * [manga hou] mkn-mr1 -> upstream/mkn-mr1 * [manga hou] revengeos-r11.0 -> upstream/revengeos-r11.0. 1 * [manga hou] whetū-S1 -> whakarunga/whetu-S11 * [manga hou] teos-n -> whakarunga/teos-n * [manga hou] weebprojekt-11 -> whakarunga/weebprojekt-XNUMX ✓ Marau kano

Kei te kite koe kaore au i whakamahi i te "-b cm-14.1" me te tohenga roa. Mai i te ra o tenei tuhinga, Hui-tanguru 16, 2022, he pepeha a GH e kore e tukuna tika nga tohenga poto ki a Git CLI, na reira me mahi hei tohenga roa.

Ka oti tena, ka uru tonu koe ki te kōpaki, ka mahia e koe o huringa, ka whakapau kaha ka pana, ka reri koe ki te tono tono. Mo tenei, ko nga mea katoa e hiahia ana koe he ngawari

$ gh pr hanga --branch ="cm-14.1" Waihanga tono kume mo wz414-taiwhanga:cm-14.1 ki cm-14.1 i te windowz414/platform_manifest ? Title teos: Huri ki te Git-Polycule ? Tinana ? He aha to muri mai? Tukuna https://github.com/windowz414/platform_manifest/pull/1

Ki te kore koe e tapiri “–manga=cm-14.1”, kei te hanga koe i te PR ki te peka “matua”, ka puta he raru ki te kore e whakahaere tika.

Na inaianei, me whakakotahi ahau i tenei PR, tika? Na ka kati ahau i te repo, ka tirotirohia ki te peka kua tohua, ka whakarārangihia nga PR i te tuatahi.

# Korohanga tuatahi. $ git clone https://github.com/windowz414/platform_manifest Te kati ki te 'platform_manifest'... mamao: Tatau taonga: 136, kua oti. mamao: Tatau taonga: 100% (136/136), kua oti. mamao: Kōpeke ahanoa: 100% (81/81), kua oti. mamao: Tapeke 136 (delta 46), whakamahia ano 89 (delta 12), kete-whakamahia ano 0 Te whiwhi taonga: 100% (136/136), 30.70 KiB | 137.00 KiB/s, kua oti. Te whakatau i nga waahanga: 100% (46/46), kua oti. # Katahi ka tirotirohia ki te peka. $ git checkout cm-14.1 peka 'cm-14.1' kua whakaritea hei whai i te 'taketake/cm-14.1'. Kua huri ki te peka hou 'cm-14.1' # Na inaianei kei te rarangi PR. $ gh pr rarangi Whakaatu 1 o te 1 tono kume tuwhera ki te matapihiz414/platform_manifest #1 teos: Huri ki Git-Polycule wz414-labs:cm-14.1

Inaianei kua kite tatou he PR hei huri i te mamao ki “Git-Polycule”, kia kite tatou he aha nga mea kua huri.

$ gh pr diff 1 diff --git a/teos.xml b/teos.xml taupū b145fc0..3aadeb6 100644 --- a/teos.xml +++ b/teos.xml @@ -2,7 +2,7, 414 @@ 

Te ahua oati! Te wa ki te hanumi!

$ gh pr hanumi 1 ? He aha te tikanga hanumi e hiahia ana koe ki te whakamahi? Whakahoutia me te hanumi ? He aha to muri mai? Tukuna mai ✓ tono kume hou me te hanumi #1 (teos: Huri ki te Git-Polycule)

Inaianei kua hanumi ahau, ka taea e koe te whakakore i to marau.

$ gh repo delete --whakaū wz414-labs/platform_manifest ✓ Kua mukua te rehitatanga wz414-labs/platform_manifest

Ka kite koe kua mukua te repo me te kore tono whakau na te mea kua paahitia e ahau te tohu "–whakaae" ki reira. Ki te kore koe e paahi, ka whiwhi koe i tenei:

$ gh repo mukua windowz414/systemd? Patohia te windowz414/systemd hei whakaū i te mukunga:

A ka hiahia koe ki te pato i te ingoa repo katoa. Te moumou taima…

whakarāpopototanga

Me korero noa, ko te `gh` he takai Git CLI/Curl tino ngawari e whakakotahi ana i nga mahi Git ngawari me nga mea API GitHub i raro i te tuanui kotahi. Me pehea koe e whakamahi ai? He ahua pai ki a koe penei me au? Kei te titiro whakamua ki te whakarongo mai i a koe!

Tefito pā