Building off of @Gavin's answer:

Making lazygit a function instead of an alias allows you to pass it an argument. I have added the following to my .bashrc (or .bash_profile if Mac):

function lazygit() {
    git add .
    git commit -a -m "$1"
    git push
}

This allows you to provide a commit message, such as

lazygit "My commit msg"

You could of course beef this up even more by accepting even more arguments, such as which remote place to push to, or which branch.

Answer from btse on Stack Overflow
🌐
GitHub
docs.github.com › en › get-started › using-git › pushing-commits-to-a-remote-repository
Pushing commits to a remote repository - GitHub Docs
Use git push to push commits made on your local branch to a remote repository. ... As an example, you usually run git push origin main to push your local changes to your online repository.
Discussions

Does git commit automatically create a new version?
Q. Your Title A. NO Q. What does it actually track: content or file names? A. Content Q. do git users generally use git locally in general A. It is a distributed system and commit often is the reccomendation. More on reddit.com
🌐 r/git
19
0
March 20, 2022
To what extend do you use git blame / value an accurate git history
It is incredibly important so that when I yell "Who was the fucking moron that did this?" I can then view the "he's me" obi wan meme. More on reddit.com
🌐 r/ExperiencedDevs
56
29
3 weeks ago
i am trying to add and commit in single line , but its refusing to do so
It's because 1.txt is untracked. When you pass the -a flag to git commit, it only picks up changes to tracked files. From the documentation (emphasis mine): -a --all Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected. Further below in the same documentation (under the EXAMPLES section), it explains more clearly: Instead of staging files after each individual change, you can tell git commit to notice the changes to the files whose contents are tracked in your working tree and do corresponding git add and git rm for you. ... The command git commit -a first looks at your working tree, notices that you have modified hello.c and removed goodbye.c, and performs necessary git add and git rm for you. On this subject, I recommend adding each change individually with git add. (In this case, git add 1.txt and then git commit without -a.) It's a good habit because if you explicitly name each individual file, then you tend to be more conscious of what you're doing, which helps avoid mistakes like committing changes/files by accident. (For example: files with secrets, build output, or temporary files.) Later, after you've used Git for a long time, you might want to switch to using commands that add all changes. More on reddit.com
🌐 r/git
4
0
September 25, 2023
Whats the purpose of a git commit VS git push?
Some programmers like to have a clean commit history, so after they make all the commits like "A small fix", "Correction to the fix", "It works this time" etc, they squash commits and rewrite them so they make sense. Also, one might not want to have their commits on the server before it's finished so it can be rebased and corrected without force pushing. More on reddit.com
🌐 r/learnprogramming
28
48
February 6, 2023
🌐
GitHub
docs.github.com › en › migrations › importing-source-code › using-the-command-line-to-import-source-code › adding-locally-hosted-code-to-github
Adding locally hosted code to GitHub - GitHub Docs
For example, gh repo create --source=. --public. Specify a remote with the --remote flag. To push your commits, pass the --push flag. For more information about possible arguments, see the GitHub CLI manual.
🌐
CloudBees
cloudbees.com › blog › git-push-an-in-depth-tutorial-with-examples
Git Push: An In-Depth Tutorial With Examples
In other words, Git has no idea to which branch in the repo it should send our commits. Actually, we want Git to create this new branch on the remote. We can solve this by explicitly telling Git the names of the remote and the branch, using the syntax git push <REMOTE-NAME> <BRANCH-NAME>. In our case, the complete command is git push origin exp.
🌐
Adsittech
adsittech.com › blog › series › practical-programming › supplemental › git-push
Supplemental Article - Git Commit and Push | Michael Adsit Technologies, LLC
1git add . 2git commit -m "<DETAILED INFORMATION ABOUT THE CHANGES GOES HERE>" 3git push 4Copy Code To Clipboard · To use Visual Studio Code's built in Source control, click the Source Control button on the side - it has three circles connected by a line. Then, write a message where it says ...
Find elsewhere
🌐
GitLab
docs.gitlab.com › topics › git › commands
Common Git commands | GitLab Docs
You can change the name of the default branch with git branch -m <branch_name>, or initialize with git init -b <branch_name>. Use git pull to get all the changes made by users after the last time you cloned or pulled the project. ... Use git push to update remote refs. ... For more information, ...
🌐
GitLab
docs.gitlab.com › tutorials › make_first_git_commit
Tutorial: Make your first Git commit | GitLab Docs
You store files, like code or ... to your computer, make the changes, and push your changes back to the repository. In GitLab, a Git repository is located in a project. Each time you push a change, Git records it as a unique commit....
🌐
Kev Quirk
kevquirk.com › git-commit-and-push-script
A Script to Automate Git Add, Commit & Push - Kev Quirk
February 19, 2023 - I'm typing the post in Typora; so being able to flip to the command line and enter a single command, would be great. Since I use an M1 Macbook Air, which is basically Unix under the hood, I can use good old BASH to do this. So I used the following script (thanks to StackOverflow): #!/bin/bash read -p "Commit message: " desc git add . && \ git commit -m "$desc" && \ git push
🌐
The Odin Project
theodinproject.com › lessons › foundations-git-basics
Git Basics | The Odin Project
Take one last look at your commit history by typing git log. You should now see three entries. Finally, let’s upload your work to the GitHub repository you created at the start of this tutorial. Type git push.
🌐
Kansas State University
textbooks.cs.ksu.edu › cc410 › z-examples › 01-hello-real-world › 04-java › 04-git-commit-push › index.html
Git Commit & Push :: CC 410 Textbook
June 17, 2024 - # check that the correct files are added git status # update the commit message below git commit -m "Commit Message Here" git push That will commit and push your changes to GitHub, which can now be found in the repository for this assignment.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Git add commit push - Visual Studio Marketplace
November 7, 2019 - Extension for Visual Studio Code - Three git commands in one easy shortcut!
🌐
Atlassian
atlassian.com › git › tutorials › syncing › git-push
Git Push | Atlassian Git Tutorial
First, it makes sure your local ... a good opportunity to clean up your commits before sharing them. Then, the git push command sends all of the commits on your local main to the central repository....
🌐
Atlassian
atlassian.com › git › tutorials › saving-changes › git-commit
Git Commit | Atlassian Git Tutorial
These two commands git commit and git add are two of the most frequently used. While they share the same name, git commit is nothing like svn commit. This shared term can be a point of confusion for Git newcomers who have a svn background, and it is important to emphasize the difference. To compare git commit vs svn commit is to compare a centralized application model (svn) vs a distributed application model (Git). In SVN, a commit pushes ...
🌐
Webriq
app.webriq.com › help › page › basic › commit
Commit Changes
Open your (CLI) command line editor and type the codes below to commit your changes · git add . git commit –m “Changes description” git push origin master · If you encountered an error while commiting your changes make sure you have followed the instruction ·
🌐
Visual Studio Code
code.visualstudio.com › docs › sourcecontrol › overview
Source Control in VS Code
November 3, 2021 - You can publish a local repository directly to GitHub with the Publish to GitHub command, which creates a new repository and pushes your commits in one step.
🌐
Git
git-scm.com › docs
Git - Reference
Complete list of all commands · git · config · help · bugreport · Credential helpers · init · clone · add · status · diff · commit · notes · restore · reset · rm · mv · branch · checkout · switch · merge · mergetool · log · stash · tag · worktree · fetch · pull · push ·
🌐
GitLab
docs.gitlab.com › topics › git › commit
Stage, commit, and push changes | GitLab Docs
You can stage all your changes and commit them with one command: git commit -a -m "<comment that describes the changes>" Be careful your commit doesn’t include files you don’t want to record to the remote repository. As a rule, always check the status of your local repository before you ...
🌐
Graphite
graphite.com › guides › git-commit-vs-push
Understanding the differences between `git commit` and `git push`
This makes it easier to track changes and roll back if necessary. Push selectively: Push changes to the remote repository when they are ready to be shared or when collaboration is required.
🌐
Kontext
kontext.tech › home › blogs › tools & systems › git - push tags and commits atomically
Git - Push Tags and Commits Atomically - Kontext Labs
April 7, 2021 - When adding tags to a certain commit in git local repository, it might be important to push the tags and commits to remote repository simultaneously to ensure CI/CD pipeline is triggered correctly. For example, if build pipeline has steps that are created with custom condition which is based on tag patterns. For this scenario, you may not want to trigger the pipeline until the tag is pushed. To push tags and commits simultaneously, you will need to use different commands ...