Skip to content

masukomi/git_accessories

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A tiny little repo of tiny little helper scripts for git.

git-who

Usage: git-who <filepath> [-v]

Passing it just a file path will give you an unordered list of the people who have worked on it. Ex.: foo.sh: Bob Smith, Mary Smith, Tom Jones

Adding -v lists out the names of the people who have touched it, in order. Ex.:

foo.sh: Bob Smith, Mary Smith, Bob Smith, Tom Jones, Bob Smith

git-status-report

Generates a status report for what you (or a coworker) worked on for the past n days from all of the branches from a pre-configured list of repos (see below) or the current repo.

Useful for those once a week emails your boss is always asking for.

Please note. git-status-report requires the Grit gem to function (gem install grit).

Usage: git status-report [-e <email>][-d <days>]
Generates a status report for what you worked on for the past n days.
    -a, --all                        Displays output for all contributers sorted by person
    -b, --branches <branch name>     Limit results to work found in the specified branch(es). 
                                         Multiple branches can be comma separated
    -c, --current                    Generates status report for the current repo only
    -d, --days <num days>            The number of days to generate the report for. Defaults to past 6 days (one week)
    -e, --email <email address>      The email address of the committer to generate a report for. 
                                         Defaults to your "git config user.email" address. 
                                         Multiple email addresses can be comma separated.
    -f, --files                      Display a list of files involved in the commit(s)
    -h, --help                       Displays this message
    -r, --reverse                    Displays output in reverse chronological order
    -s, --simple                     Simpler output. Doesn't include the dates
    -v, --verbose                    Verbose output includes details on each commit

If you wish to pre-configure a list of repos to build you status report from (and you should) you can do so by adding them to git's global config as shown below. You can add as many include or exclude paths as you'd like. of absolute paths to your local repos (the folder containing the .git folder). Verbose mode will let you know which branch of which repo each item came from.

If you don't specify any "includes" it will attempt to find repos in the current directory or directories below it.

git config --global --add status-report.include /Users/masukomi/workspace/git_accessories
git config --global --add status-report.include /Users/masukomi/workspace/jsonpath-perl
git config --global --add status-report.exclude /Users/masukomi/workspace/some_repo_i_want_excluded_from_status-report

Please note that it does not currently support wildcard exclusions.

If you don't want to use the default e-mail in "git config user.email" or you want to specify more than one, but not all, in your default status report you can set those in the status-report section of your git config as well.

git config --global --add status-report.email first-person@example.com
git config --global --add status-report.email second-person@example.com

Configuration Options

In addition to configuring includes and excludes you can pre-configure the number of days you want the status report to include in its run without having to manually specify it on the command line. By default it will include 6 days which is perfect if you run it on Fridays and want the previous week's work. But if you run it on a Monday you'll probably want it to default to seven.

git config --global --replace-all status-report.days 7

Finding Repos when none are configured

git-status-report will looks in three places for repos and uses whichever one works first.

  1. it will check the git global config for "include" repos.
  2. it will check if the current directory is a working repo.
  3. it will do a "find" to discover any working repos below the current directory.

All of these are trumped by paths excluded in the global config.

Finding repos is really rather slow. It's always a better idea to pre-configure them.

Planned Features

Please see the wiki page on github. If you're interested in helping please fork this repo (preferably on Github) and request a pull when you've got something ready to add.

Example output

Default output

$ git status-report -d 10
Status report for "masukomi@masukomi.org" (last 10 days)
2010-07-19
	* git-status-report now notes branch it was generated from in verbose mode
	* Added break to git-status-report's current branch lookup for efficiency.
2010-07-21
	* mistakenly had -s instead of -v for short version of --verbose
	* Updated README to include git-status-report info
2010-07-23
	* git-status-report now generates report from all branches
	* git-status-report now supports a --reverse option
	* Updated README.mkdn to include info on --reverse

Simple Output

$ git status-report -sd 10
Status report for "masukomi@masukomi.org" (last 10 days)
	* git-status-report now notes branch it was generated from in verbose mode
	* Added break to git-status-report's current branch lookup for efficiency.
	* mistakenly had -s instead of -v for short version of --verbose
	* Updated README to include git-status-report info
	* git-status-report now generates report from all branches
	* git-status-report now supports a --reverse option
	* Updated README.mkdn to include info on --reverse

Verbose Output

$ git status-report -vd7
Status report for "masukomi@masukomi.org" (last 7 days)
2010-07-21
	commit 1----------
		mistakenly had -s instead of -v for short version of --verbose
		[Found in branch "development" of repo at /Users/masukomi/workspace/git_accessories]
	commit 2----------
		Updated README to include git-status-report info
		
		* added markdown formatting
		* renamed file README -> README.mkd
		[Found in branch "development" of repo at /Users/masukomi/workspace/git_accessories]
2010-07-23
	commit 1----------
		git-status-report now generates report from all branches
		
		* output has been sorted chronologically (instead of reverse cron)
			this is because it makes a more sensible default for
			something you're giving to a boss. AND because the next
			commit will be a --reverse option which gives you the
			some info in reverse chronological order.
		[Found in branch "development" of repo at /Users/masukomi/workspace/git_accessories]
	commit 2----------
		git-status-report now supports a --reverse option
		
		* produces output in reverse chronological order
		[Found in branch "development" of repo at /Users/masukomi/workspace/git_accessories]
	commit 3----------
		Updated README.mkdn to include info on --reverse
		
		* also did minor formatting changes
		[Found in branch "development" of repo at /Users/masukomi/workspace/git_accessories]

"all" output

Output for the -a / --all option is essentially the same as the output above only with the addition of a note as to which commit came from which contributer.

About

assorted little helper scripts for git

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages