บันทึกของฮองมู

git commit

ส่งไฟล์ไปยังคลังเก็บ

100% การประมวลผลภายในเบราว์เซอร์ 0 การอัพโหลดข้อมูล

ตัวอย่างที่ใช้บ่อย

ส่งไฟล์ที่จัดเก็บชั่วคราวเข้าสู่คลัง โดยแนบข้อมูลคำชี้แจงการส่งเข้าไปด้วย

git commit {{[-m|--message]}} "{{信息}}"

ส่งไฟล์ที่จัดเก็บชั่วคราว และอ่านข้อมูลการส่งที่แนบมาพร้อมกันจากไฟล์ที่กำหนด

git commit {{[-F|--file]}} {{路径/到/提交信息文件}}

บันทึก และส่งเอกสารทั้งหมด ที่มีการแก้ไข และลบโดยอัตโนมัติมาพร้อมกับข้อมูลการส่ง

git commit {{[-a|--all]}} {{[-m|--message]}} "{{信息}}"

ส่งไฟล์ที่จัดเก็บชั่วคราว และใช้กุญแจ GPG ที่กำหนดเพื่อเซ็นชื่อ (หากไม่ได้กำหนดพารามิเตอร์ ให้ใช้ค่าที่กำหนดไว้ในไฟล์การตั้งค่า)

git commit {{[-S|--gpg-sign]}} {{密钥id}} {{[-m|--message]}} "{{信息}}"

นำการเปลี่ยนแปลงที่จัดเก็บชั่วคราวในปัจจุบันมา追加เข้ากับการ commit ล่าสุด และอัปเดตค่าแฮชของมัน

git commit --amend

ส่งเฉพาะไฟล์ที่ระบุไว้ (ซึ่งถูกจัดเก็บไว้ชั่วคราว) เท่านั้น

git commit {{路径/到/文件1 路径/到/文件2 ...}}

แม้จะไม่มีไฟล์ชั่วคราว ก็ยังสร้างและส่งออกได้

git commit {{[-m|--message]}} "{{信息}}" --allow-empty

หมายเหตุ: วงเล็บปีกกา{{…}}เป็นพารามิเตอร์ที่ต้องเปลี่ยนแปลง (เช่น เส้นทาง ชื่อไฟล์ เป็นต้น) คำสั่งจะถูกดำเนินการเฉพาะบนเทอร์มินัลของเครื่องนี้เท่านั้น โดยเว็บไซต์นี้จะไม่บันทึกข้อมูลที่ป้อนเข้ามาใดๆ

การเปรียบเทียบกับต้นฉบับภาษาอังกฤษ

เปิดเผยคำอธิบายและตัวอย่างภาษาอังกฤษ (ที่มา: tldr-pages)

Commit files to the repository. More information

Open an editor to write a message and commit staged files to the repository

git commit

Commit staged files to the repository with the specified message

git commit {{[-m|--message]}} "{{message}}"

Commit staged files with a message read from a file

git commit {{[-F|--file]}} {{path/to/commit_message_file}}

Auto stage all modified and deleted files and commit

git commit {{[-a|--all]}} {{[-m|--message]}} "{{message}}"

Commit staged files and sign them with the specified GPG key (or the one defined in the configuration file if no `key_id` is specified)

git commit {{[-S|--gpg-sign]}} {{key_id}} {{[-m|--message]}} "{{message}}"

Update the last commit by adding the currently staged changes, changing the commit's hash and open an editor to change the message

git commit --amend

Commit only specific (already staged) files

git commit {{path/to/file1 path/to/file2 ...}}

Create a commit with the specified message and description

git commit {{[-m|--message]}} "{{message}}" {{[-m|--message]}} "{{description}}"

ข้อมูลคำสั่ง

ชื่อคำสั่งgit commit
วัตถุประสงค์ส่งไฟล์ไปยังคลังเก็บ
แพลตฟอร์มที่รองรับ通用
จำนวนตัวอย่าง7 บทความ
เอกสารทางการhttps://git-scm.com/docs/git-commit
แหล่งข้อมูลtldr-pages(CC-BY-4.0)· คำแปลภาษาจีนของชุมชน

คำถามที่พบบ่อย

git commit คำสั่งทำหน้าที่อะไร?

ส่งไฟล์ไปยังคลังเก็บ

git commit ใช้อย่างไร?

หน้าเว็บจัดแสดงตามสถานการณ์7ตัวอย่างที่ใช้บ่อย: สำหรับแต่ละตัวอย่าง จะเริ่มจากการระบุวัตถุประสงค์ จากนั้นจึงแสดงคำสั่งที่สมบูรณ์ซึ่งสามารถคัดลอกใช้ได้โดยตรง (พารามิเตอร์ที่ต้องแทนที่จะอยู่ภายในวงเล็บดอกไม้)

git commit การดำเนินการที่ใช้บ่อยที่สุดคืออะไร?

ส่งไฟล์ที่จัดเก็บชั่วคราวเข้าสู่คลัง โดยแนบข้อมูลคำชี้แจงการส่งเข้าไปด้วย: :git commit {{[-m|--message]}} "{{信息}}"

วงเล็บปีกกาในคำสั่งหมายถึงอะไร?

วงเล็บดอกไม้{{…}}หมายถึงจำเป็นต้องแทนที่ด้วยค่าของคุณเอง เช่น เส้นทางหรือชื่อไฟล์; วงเล็บของพารามิเตอร์ที่มีชื่อเดียวกัน (เช่น[-C|--directory])แสดงว่าเป็นรูปแบบการเขียนที่เลือกใช้ได้