In this question Git command to commit all changes including files removed or created the answer given allows me to add, commit and push all changes made to my master
branch in one command with:
git commitall "a message describing what you did"
where commitall
is the user defined command:
commitall = "!func(){ git add -A && git commit -am \"$1\" && git push origin master; }; func"
stored in the file ~\.gitconfig
under the section [alias]
.
The problem is that this command only works when I'm positioned in the master
branch. How could I generalize this command so it will check in which branch I'm currently positioned and push the changes to that branch?