git-story
git-story copied to clipboard
Simplified git workflow.
git-story
Various extensions to git, documented below.
- Installation
- Getting Started
- Example
- Configuration
- Documentation
- Branching extensions
- Convenience extensions
- Log extensions
- Project integration extensions
- Statistics extensions
- git-story interactions
- Misc
- Notes
- License
Install git-story
curl -L https://raw.githubusercontent.com/buren/git-story/master/setup/install | bash
The above command will install and inject an import of the git-story script to either .bash_profile, .bashrc or .zshrc (in that order). See install script for details.
Reload your shell to initialize git-story extensions.
Getting started
Branch model:
- Start developing a feature, and name it
git feature <name> - Save local changes and sync with remote
git finish - Create a pull request
The principle is that you develop each new feature in its own branch and when
you're done you push it and create a pull request. See GitHub flow branch model.
Note that git feature and git finish are flexible. They both take an optional argument target-branch, which the current/new branch will sync with.
Example
$ git feature branch-name # Sets up clean workspace based on remote master.
$ git finish # Commit changes, updates current and local branch.
Output example (video).
Documentation
Print command usage:
$ git <git-story-extension> --usage
Branching extensions
-
Start developing a feature
$ git feature <branch-name> <target-branch>this will create a new branch branch-name based of master or specified target-branch. If the branch exists on remote pull the latest changes. Ensures the uniqueness of branch name at remote. Pushes the created branch to remote. Executes:
- Checkout target-branch
- Pull target-branch
- Create new branch branch-name
- Push branch-name
-
Commit and sync with repository
$ git finish <target-branch>commit the changes you've made and merge changes with target-branch. target-branch is optional and the default is target-branch. Executes:
- Prompt commit message if any uncommitted changes
- Pull current branch
- Pull target-branch
- Push current branch
- Perform local merge with target-branch if configured will exit and print conflicted files if any merge conflicts are found.
-
git branch-statusshows current branch status. -
git pull-branchpull current, or specified, branch's remote changes. -
git create-branchcreate and checkout a new branch and push to remote. -
git push-branchpush the current branch to remote. -
git delete-branchdelete branch from remote and local. -
git delete-mergeddelete all merged branches locally and at remote.
Convenience extensions
git addcomadd all files and commit.git fuckitcommit all files and push current branch. Default is to prompt for commit message.git redo-commitredo last commit.git goto <branch-name>switches to branch branch-name if the working directory is clean.git abort-mergeaborts current merge.git obliterateremove file from local repository and its entire history.git zip-projectcreate zip-file of project.git ignoreadd and list patterns to local and global gitignore.git ignore-boilerplateeasy access to gitignore boilerplates from github.com/github/gitignore.git conflictedlist files with merge-conflicts.git todoslist all TODOS and FIXMES.git tag-releasecreate a new tagged release.git rename-tagrename an existing release.git changelogprint change log from last tag.git squash-commitssquash given number of commits together.
Log extensions
git historyview repository commit history.git trailshows the last common commit with current branch.git neckshow commits until first branching point.git divergenceshow the difference between current branch and the same branch at remote.git local-commitsshow local commits that haven't been pushed to remote.git commits-sinceshow commits since given time.
Project integration extensions
git browseopens the repository on GitHub.git packagepackage project, runsGS_PACKAGE.git deploypackage project, runsGS_DEPLOY.git install-projectinstall project, runsGS_INSTALL.git testpackage project, runsGS_PRE_COMMIT_HOOK.git tag-releasetags release, runsGS_TAG_RELEASE.
Statistics extensions
-
Show statistics for repository
git stat <type> types: contrib <name> # shows statistics for all or specified author (alias: contributions) commits # shows number of commits for each author weekdays # prints statistics for number of commits per weekday hour # prints statistics for number of commits per hour files # prints number of files and lines diff # Print stat of uncommitted changes log # Print log with stat modified # Print stat of most modified filesprints statistics of given type.
-
git churncount number of changes for each file. -
git effortlike churn, but prettier and with active day count. -
git summaryshow summary for current project.
git-story interactions
git gs-updategets the latest version of git-story.git gs-extend <extension-name>add new git-story extension to git.git gslist git-story extensions.
Misc
git replgit read-eval-print-loop (REPL).
Configuration
Configure git-story by creating a file ~/.gitstoryrc
For project specific configurations create a file named .gitstoryrc at the project's git root.
See full example with comments in docs/gitstoryrc-example.
Available options and their default value:
GS_DEFAULT_REMOTE='origin' # Default remote for git story
GS_GIT_STORY_BRANCH='master' # Target branch for 'feature' & 'finish'
GS_LOCAL_MERGE=false # Perform local merge on 'finish'
GS_PRINT_CHECKLIST=false # Print checklist before 'finish'
GS_GRAPHIC_PROMPT=false # Show all prompts (on OSX) in a GUI dialog
GS_PROMPT_ON_DONE=false # Prompt user before 'finish'
GS_TEST_ON_DONE=true # Run test command before 'finish'
GS_SIGN_RELEASE=true # Sign tags created with 'tag-release'
GS_SIGN_COMMITS=true # Sign each commit created with addcom, with GPG-key
GS_SIGN_COMMITS_STRING=true # Sign each commit created with addcom, with --signoff
GS_CHECKLIST_MESSAGE='...' # Checklist string for 'finish'
GS_PRE_COMMIT_HOOK='' # A command that runs all tests
GS_PACKAGE='' # Shell command for 'package'
GS_DEPLOY='' # Shell command for 'deploy'
GS_TAG_RELEASE='' # Shell command for 'tag-release'
GS_INTSALL='' # Shell command for 'install'
GS_HAS_GITHUB=true # Project has GitHub.
GS_PROJECT_URL='' # Project URL
GS_TEST_ON_AUTO_MERGE=true # Run tests command on auto merge
GS_PRODUCTION_BRANCH='heads/master' # Integration branch for production
GS_NEXT_VERSION_BRANCH='' # Integration branch for next
GS_EDGE_BRANCH='' # Integration branch for edge
GS_GIT_STORY_EXT_BRANCH='master' # Target branch for git-story extension
Notes
- The software is supplied “as is” and all use is at your own risk (see license)
git branch-statusrequires Ruby 1.8.7 or greater- Tested on Linux/OSX/Windows using both zsh, bash and cygwin*, doesn't work with sh.
- Almost everything works with cygwin except:
git trailgit neckboth neck and trail fails ongit -p column
- Fork the repository and update the URL defined in setup/install to install and use your own version of git-story
- Thanks:
- Uninstall git-story:
rm -rf ~/.git-story
License
git-story is released under the MIT License.