Skip to content

A set of aliases for improving git commit tracking and overall command line simplification.

Notifications You must be signed in to change notification settings

izcet/gitpushplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Push Plus (GPP)

I don't always have the time or remember to write out a verbose commit message of all the changes I made to any number of files, especially when I make multiple small changes. So It's more useful to me to be able to quickly see which files were added, edited, and removed when, so I can backtrack to a specific commit more quickly.
I originally just made this for me but I've had a couple requests by others who found it cool so I created this separate repo to allow others to install.

Features:

  • Fully add/commit/push a file with only one command!
  • Always verbose commit messages!
  • Multiple remote push automation!
  • Painless, one-time setup with customization!
  • Bash Wizardry!

Setup:

Just download and run install.sh, and the setup process is pretty painless. It asks you some questions about your environment and preferences, and then copies/generates the necessary files.

install.sh
It appends the necessary sourcing to the specified file (.bashrc in this example):

####  Git Push Plus variables and setup  ####

export GPP_DIR=/tmp/bar/
export GPP_GREEN='^[[0;32m'
export GPP_BLUE='^[[0;34m'
export GPP_PURPLE='^[[0;35m'
export GPP_RED='^[[0;31m'
export GPP_NOCOLOR='^[[0m'

source ${GPP_DIR}aliases.sh

####          End Git Push Plus          ####

And generates/copies the files being sourced (aliases.sh):

GPP_EDITOR=vim

function gp () {
	if [ $# != 0 ] ; then
		while [ "$1" != "" ] ; do
			echo -n "${GPP_GREEN}$1: ${GPP_PURPLE}"
			git push $1 master
			shift
		done
	else
		GPP_TEMP_FILE="$(whoami)_temp_file_$(date).txt"
		git remote > $GPP_TEMP_FILE
		while read line ; do
			echo -n "${GPP_GREEN}$line: ${GPP_PURPLE}"
			git push $line master
		done < $GPP_TEMP_FILE
		rm -rf $GPP_TEMP_FILE
	fi
	echo -n "$GPP_NOCOLOR"
}

alias gu="git pull"
alias gstat="git status"
alias ga="git add ."

function gc () {
	git commit -m "$(sh /tmp/bar/commit_script.sh $1)"
}

function gall () {
	gstat && ga && gstat && gc $1 && gp
	gstat
}

Verbose commits

  • Takes advantage of grep and git status to parse the changes into a string.
  • Takes optional user input to provide custom commit messages prior to the list of changed files.
  • source
$> gc
[master 3d980cd] [README.md] +[pic/commit.png]
 2 files changed, 3 insertions(+)
 create mode 100644 pic/commit.png
$>
$> gc "Updated Readme and revised image preview"
[master 6d2ddf3] Update Readme and revised image preview [pic/install.png] [install.sh] [README.md]
 3 files changed, 20 insertions(+), 4 deletions(-)
 rewrite pic/install.png (95%)
$>
$> gc you can do without quotes also
[master 3014973] you can do without quotes also [README.md]
 1 file changed, 1 deletion(-)
$>

Git Push Plus All

This command chains together all of the other shorthands to provide a quick way to fully commit and push to all remotes. You can combine the optional verbose commit message with this command and it's passed through.

Git Push Plus All

About

A set of aliases for improving git commit tracking and overall command line simplification.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages