DEV Community

Long Nguyễn Xuân
Long Nguyễn Xuân

Posted on • Edited on

git add, commit, push với 1 command duy nhất

Nói trước

dành cho những bạn "tui biết tui đang muốn làm gì"

thao tác

mở file ~/.bashrc và thêm dòng này vào

function gacp() {
    git add .
    git commit -a -m "$1"
    git push
}
Enter fullscreen mode Exit fullscreen mode

hoặc dòng này nếu muốn dùng alias thay vì function, cred: Lê Ngọc Thắng

alias gacp='git add . && git commit -am "$1" && git push'
Enter fullscreen mode Exit fullscreen mode

enjoy bằng

$ gacp finish feature 08

# kết quả sẽ như sau 
# [master 9be82ff] update
#  2 files changed, 36 insertions(+), 15 deletions(-)
#  rewrite ... (84%)
# Enumerating objects: 11, done.
# Counting objects: 100% (11/11), done.
# Delta compression using up to 6 threads
# Compressing objects: 100% (5/5), done.
# Writing objects: 100% (6/6), 1.19 KiB | 609.00 KiB/s, done.
# Total 6 (delta 1), reused 0 (delta 0), pack-reused 0
# remote: Analyzing objects... (6/6) (8 ms)
# remote: Storing packfile... done (57 ms)
# remote: Storing index... done (48 ms)
# To https://.../_git/...
#    e6c3f7e..9be82ff  master -> master
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

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