Skip to content

Latest commit

 

History

History
150 lines (105 loc) · 3.69 KB

README.md

File metadata and controls

150 lines (105 loc) · 3.69 KB

git cococo: git COmmit COmpletely COmmand output

License X11 Latest tag Build Status Build Status Build Status

Requirements

  • Git

Installation

git cococo is written by shell script. So we can install following:

$ wget https://raw.githubusercontent.com/nishidayuya/git-cococo/master/exe/git-cococo
$ chmod a+x git-cococo
$ mv git-cococo move-to-PATH-env-directory/

Usage

Run sed command and commit changes with re-runnable commit message "run: git cococo sed -i -e s/foo/bar/g a.txt".

$ git cococo sed -i -e s/foo/bar/g a.txt

Oops! I forgot un-commmitted changes. git cococo tells me it and don't run command.

$ git cococo sed -i -e s/foo/bar/g a.txt
Detects following uncommitted changes:

     M b.txt
    ?? c.txt

Run "git stash" and retry "git cococo":

    $ git stash --include-untracked &&
      git cococo sed -i -e s/foo/bar/g a.txt &&
      git stash pop

Or, use "--autostash" option:

    $ git cococo --autostash sed -i -e s/foo/bar/g a.txt

Replace writed to wrote all of git tracked files and commit.

$ git cococo sh -c 'git ls-files -z | xargs -0 sed -i -e s/writed/wrote/g'

Examples

for Rubyists

$ git cococo --init bundle init
$ git cococo rbenv local 2.7.0
$ git cococo bundle add rake
$ git cococo bundle update nokogiri

$ n=new_awesome_gem && git cococo --init=$n bundle gem $n

$ n=blog && git cococo --init=$n rails new $n
$ cd $n
$ git cococo bin/rails generate scaffold post title body:text published_at:datetime
$ git cococo bin/rails db:migrate

for JavaScripters

$ git cococo --init npm init --yes
$ git cococo sh -c 'echo /node_modules | tee -a .gitignore'
$ git cococo npm install --save express
$ git cococo npm install --save-dev mocha

for Pythonistas

$ git cococo --init pyenv local 3.8.1
$ git cococo touch requirements.txt
$ git cococo sh -c 'echo /venv | tee -a .gitignore'
$ python -m venv venv
$ git cococo sh -ex -c '
    . venv/bin/activate
    pip install -r requirements.txt
    pip install --upgrade pip
    pip install tensorflow
    pip freeze | tee requirements.txt
  '

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nishidayuya/git-cococo .

Development

  • Ruby: To run rake command and tests.
  • CMake: To build rugged.gem for tests.
  • Shellcheck: To run lint.

Clone this project.

Install related RubyGems and run tests and lint:

$ bundle
$ bundle exec rake

Write some changes with tests.

Run tests and lint:

$ bundle exec rake

Submit pull-request.

Thank you!

Tools for development

To use specified version of Git:

$ v=2.11.0
$ ./tools/install_git $v
$ ./tools/switch_git $v
git version 2.11.0

To use latest released version of Git:

$ v=$(./tools/latest_git_version)
$ ./tools/install_git $v
$ ./tools/switch_git $v