Skip to content

Instantly share code, notes, and snippets.

@marawannwh
Forked from Abushawish/quickgit.fish
Created December 4, 2024 02:58
Show Gist options
  • Save marawannwh/1895001d745ba9fde04a38384badba6e to your computer and use it in GitHub Desktop.
Save marawannwh/1895001d745ba9fde04a38384badba6e 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment