Last active
December 4, 2024 02:58
-
-
Save Abushawish/3440a6087c212bd67ce1e93f8d283a69 to your computer and use it in GitHub Desktop.
Git add, commit, and push in one function for Fish Shell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to git add, commit, and push using one function in friendly interactive shell (Fish Shell). | |
# Save this file within '~/.config/fish/functions' as 'quickgit.fish'. Create the directory if it does not exist. | |
# '--git-dir=$PWD/.git' Ensures that we run the git commands against the git project where we called the function | |
function quickgit # This is the function name and command we call | |
git --git-dir=$PWD/.git add . # Stage all unstaged files | |
git --git-dir=$PWD/.git commit -a -m $argv # Commit files with the given argument as the commit message | |
git --git-dir=$PWD/.git push # Push to remote | |
end | |
# Restart terminal, navigate to project, make changes, and now you can call 'quickgit "example message"'. | |
# Changes will now be added, committed, and push :). | |
# Inspired by an answer found on SO https://stackoverflow.com/a/23328996/1852191 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. Based on this gist I created one were the message argument is optional: https://gist.github.com/PapayaMedia/2c6883671377a66a171a3e5942a3de3d