Git Workflow with a "Lazy" Alias

y3asin

Yeasin Arafat

Posted on October 24, 2024

Git Workflow with a "Lazy" Alias

Steps to Set Up the "Lazy" Alias

Open the Git Configuration File

On macOS or Linux, open your terminal and run:

git config --global --edit
Enter fullscreen mode Exit fullscreen mode

On Windows, use:

git config --global -e

Enter fullscreen mode Exit fullscreen mode

Add the Alias Using Vim

Once the configuration file opens (by default in Vim), navigate to the section labeled [alias]. If it doesn't exist, create it.
Add the following code under the [alias] section:

[alias]
    lazy = "!f() { git add -A && git commit -m \"$@\" && git push; }; f"
Enter fullscreen mode Exit fullscreen mode

Save and Exit

In Vim, press Esc and type :wq to save and close the file.

NOTE: Instead of "lazy" you can use any shortcut you want.

Usage of the "Lazy" Alias

Now, you can commit and push changes with a single command. Simply type:

git lazy "Your commit message"
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
y3asin
Yeasin Arafat

Posted on October 24, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024

How to Use KitOps with MLflow
beginners How to Use KitOps with MLflow

November 29, 2024

Modern C++ for LeetCode 🧑‍💻🚀
leetcode Modern C++ for LeetCode 🧑‍💻🚀

November 29, 2024