Giter VIP home page Giter VIP logo

git_helpers's Introduction

git_helpers

Gem Version Ruby test result Build Status

Description

Librairies to help with interacting with git repositories.

This package provides the following binaries:

  • diff-fancy.rb: like diff so fancy but in ruby and with more features
  • gitsatus.rb: lie zsh git prompt but in ruby and with more features too!

Diff Fancy

The output is very similar to diff-fancy.rb. With the following differences:

  • diff-fancy.rb implement a parser of git diff. It is then very easy to tweak the output afterwards. The original diff-fancy relies on regexp, which makes it harder to customize.
  • support for submodules change in the diff
  • support for octopus merge
  • clean up 'No new line at end of file' for symlinks (which never have a new line)

TODO:

  • support 'git log -p --graph'
  • support git config to activate features on a repo basis

gitsttatus.rb

gitstatus.rb [options] git_dirs
    -p, --[no-]prompt                To be used in shell prompt
                                     This ensure that color ansi sequence are escaped so that they are not counted as text by the shell
    -s, --[no-]status[=options]      List file
                                     Print the output of git status additionally of what this program parse
    -c, --[no-]color                 Color output
                                     on by default
        --[no-]sequencer             Show sequencer data (and also look for bare directory)
                                     on by default
        --indent spaces              Indent to use if showing git status
                                     2 by default, 0 for empty ARGV
        --describe sha1/describe/contains/branch/match/all/magic
                                     How to describe a detached HEAD
                                     'branch-fb' by default
    -i, --[no-]ignored[=full]        Show ignored files
    -u, --[no-]untracked[=full]      Show untracked files
        --[no-]branch                Get branch infos (true by default)
        --[no-]files                 Get files infos (true by default)
        --use=branch_name            Show a different branch than HEAD
        --[no-]raw                   Show raw status infos
        --sm                         Recurse on each submodules
        --max-length=length          Maximum status length
        --[no-]debug                 Debug git calls

Examples

  • gitstatus.rb folders
  • git diff | diff-fancy.rb

Here is my .gitconfig using diff-fancy.rb:

	highlight = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd \"$GIT_PREFIX\"; GIT_PAGER=\"diff-fancy.rb\" git $@; }; f"
	di = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd \"$GIT_PREFIX\"; GIT_PAGER=\"diff-fancy.rb\" git diff -B $@; }; f"
	dc = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd \"$GIT_PREFIX\"; GIT_PAGER=\"diff-fancy.rb\" git diff -B --staged $@; }; f"
	dw = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd \"$GIT_PREFIX\"; GIT_PAGER=\"diff-fancy.rb --no-highlight\" git diff -B --color-words $@; }; f"
	dcw = "!f() { [ \"$GIT_PREFIX\" != \"\" ] && cd \"$GIT_PREFIX\"; GIT_PAGER=\"diff-fancy.rb --no-highlight\" git diff -B --staged --color-words $@; }; f"

Install

~~~ sh
$ gem install git_helpers
~~~

Copyright

Copyright ยฉ 2016โ€“2020 Damien Robert

MIT License. See LICENSE.txt for details.

git_helpers's People

Watchers

James Cloos avatar Damien Robert avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.