Skip to content

Instantly share code, notes, and snippets.

@Abushawish
Last active August 12, 2021 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abushawish/3440a6087c212bd67ce1e93f8d283a69 to your computer and use it in GitHub Desktop.
Save Abushawish/3440a6087c212bd67ce1e93f8d283a69 to your computer and use it in GitHub Desktop.
Git add, commit, and push in one function for Fish Shell
# 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
@PapayaMedia
Copy link

Thank you. Based on this gist I created one were the message argument is optional: https://gist.github.com/PapayaMedia/2c6883671377a66a171a3e5942a3de3d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment