DEV Community

Weerasak Chongnguluam
Weerasak Chongnguluam

Posted on • Edited on

git log จำกัดจำนวน commits ด้วย option -<number>

เมื่อวานได้รู้อีก option ของคำสั่ง git log ที่เอาไว้ดูรายละเอียดของ commits ของ git repository โดยปกติจะไล่เรียกจาก commit ล่าสุดย้อนกลับไปหา commit ก่อนหน้า โดยปกติถ้าเราสั่ง git log เฉยๆมันจะลิสต์มาทั้งหมดเลย แต่ถ้าเราอยากจำกัดจำนวนเอา commit ที่ให้ git log ลิสต์มาให้นั้น เราสามารถใส่ option รูปแบบนี้ได้

git log -<number>
Enter fullscreen mode Exit fullscreen mode

โดยที่ <number> คือจำนวน commit เช่น

# From https://github.com/gofiber/fiber repository
$ git log -2

commit 61f5c43dca6010a11a51eab383a06968bd7c89fb (HEAD -> master, tag: v2.2.5, origin/master, origin/HEAD)
Merge: 07aa649 3242e5b
Author: Joey <fenny@gofiber.io>
Date:   Fri Dec 11 01:03:39 2020 +0100

    Merge pull request #1073 from Fenny/master

    🚧 refactor bodyparser

commit 3242e5b151ae84d66b77b31318deedbabc6d5c3f
Author: Fenny <25108519+Fenny@users.noreply.github.com>
Date:   Fri Dec 11 00:59:32 2020 +0100

    🚀 allow incase-sensitive ctypes in bodyparser

    Co-Authored-By: Mones Zarrugh <11161902+moneszarrugh@users.noreply.github.com>
Enter fullscreen mode Exit fullscreen mode

ขอฝาก Buy Me a Coffee

สำหรับท่านใดที่อ่านแล้วชอบโพสต์ต่างๆของผมที่นี่ ต้องการสนับสนุนค่ากาแฟเล็กๆน้อยๆ สามารถสนับสนุนผมได้ผ่านทาง Buy Me a Coffee คลิ๊กที่รูปด้านล่างนี้ได้เลยครับ

Buy Me A Coffee

ส่วนท่านใดไม่สะดวกใช้บัตรเครดิต หรือ Paypal สามารถสนับสนุนผมได้ผ่านทาง PromptPay โดยดู QR Code ได้จากโพสต์ที่พินเอาไว้ได้ที่ Page DevDose ครับ https://web.facebook.com/devdoseth

ขอบคุณครับ 🙏

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay