Skip to content

Instantly share code, notes, and snippets.

@Y3ASIN
Last active September 12, 2024 15:14
Show Gist options
  • Save Y3ASIN/2cf4d66b99c2568ccccacd98be415741 to your computer and use it in GitHub Desktop.
Save Y3ASIN/2cf4d66b99c2568ccccacd98be415741 to your computer and use it in GitHub Desktop.
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

On Windows, use:

git config --global -e

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"

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment