---
title: "สร้างคำสั่ง git ของคุณเอง (aliases)"
description: "เคยอยากย่อคำสั่ง git ให้สั้นลงไหม? จะใช้ shell alias ก็ได้ แต่ต้องคอยใส่บริบทกำกับไว้ จะได้ไม่ลืมว่า alias แต่ละตัวย่อมาจากอะไร จริง ๆ แล้วคุณสร้างคำสั่งของตัวเอง…"
canonical: https://oozou.com/til/create-your-own-git-commands-aliases-15
locale: th
date: 2020-10-13
topic: shell
---

# สร้างคำสั่ง git ของคุณเอง (aliases)

> เคยอยากย่อคำสั่ง git ให้สั้นลงไหม? จะใช้ shell alias ก็ได้ แต่ต้องคอยใส่บริบทกำกับไว้ จะได้ไม่ลืมว่า alias แต่ละตัวย่อมาจากอะไร จริง ๆ แล้วคุณสร้างคำสั่งของตัวเอง…

Published: 2020-10-13 · Topic: [shell](https://oozou.com/th/til-topics/shell) ([markdown](https://oozou.com/th/til-topics/shell.md))

เคยอยากย่อคำสั่ง git ให้สั้นลงไหม? จะใช้ shell alias ก็ได้ แต่ต้องคอยใส่บริบทกำกับไว้ จะได้ไม่ลืมว่า alias แต่ละตัวย่อมาจากอะไร จริง ๆ แล้วคุณสร้างคำสั่งของตัวเองใน git ได้เลยด้วย alias

```shell
git config --global alias.<handle> <command> 
```

ตัวอย่างเช่น ขี้เกียจพิมพ์ *git status* เลยอยากย่อให้เหลือแค่ *git s*

```shell
git config --global alias.s status
```

เท่านี้ก็เรียบร้อย ตอนนี้แค่พิมพ์ *git s* ก็ดู status ของ repository ปัจจุบันได้แล้ว

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/th/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
