Git Product home page Git Product logo

git-sh's Introduction

git-sh

A customized bash shell suitable for git work.

The git-sh command starts an interactive bash shell tweaked for heavy git interaction:

  • All git commands available at top-level (checkout master = git checkout master)
  • All git aliases defined in the [alias] section of ~/.gitconfig available at top-level.
  • Shawn O. Pearce's excellent bash completion strapped onto all core commands and git aliases.
  • Custom prompt with current branch, repository, and work tree dirty indicator.
  • Customizable via /etc/gitshrc and ~/.gitshrc config files; for creating aliases, changing the prompt, etc.
  • Runs on top of normal bash (~/.bashrc) and readline (~/.inputrc) configurations.

Status

This repository is no longer actively maintained by @rtomayko as of 2017-11-08. Issues and PRs documenting current issues have been intentionally left open for informational purposes.

Installation

Install the most recent available version under /usr/local:

$ git clone git://github.com/rtomayko/git-sh.git
$ cd git-sh
$ make
$ sudo make install

Start a shell with git-sh:

$ git-sh
master!git-sh> help

Use the PREFIX environment variable to specify a different install location. For example, under ~/bin:

$ make install PREFIX=~

Basic Usage

Typical usage is to change into a git working copy and then start the shell:

$ cd mygreatrepo
$ git sh
master!mygreatrepo> help

Core git commands and git command aliases defined in ~/.gitconfig can be used as top-level commands:

master!mygreatrepo> checkout -b new
new!mygreatrepo> log -p
new!mygreatrepo> rebase -i HEAD~10

It's really just a normal bash shell, though, so all commands on PATH and any aliases defined in ~/.bashrc are also available:

new!mygreatrepo> ls -l
new!mygreatrepo> vim somefile

IMPORTANT: rm, mv, and diff are aliased to their git counterparts. To use system versions, run command(1) (e.g., command rm) or qualify the command (e.g. /bin/rm).

Prompt

The default prompt shows the current branch, a bang (!), and then the relative path to the current working directory from the root of the work tree. If the work tree includes modified files that have not yet been staged, a dirty status indicator (*) is also displayed.

The git-sh prompt includes ANSI colors when the git color.ui option is enabled. To enable git-sh's prompt colors explicitly, set the color.sh config value to auto:

$ git config --global color.sh auto

Customize prompt colors by setting the color.sh.branch, color.sh.workdir, and color.sh.dirty git config values:

$ git config --global color.sh.branch 'yellow reverse'
$ git config --global color.sh.workdir 'blue bold'
$ git config --global color.sh.dirty 'red'
$ git config --global color.sh.dirty-stash 'red'
$ git config --global color.sh.repo-state 'red'

See colors in git for information.

Customizing

Most git-sh behavior can be configured by editing the user or system gitconfig files (~/.gitconfig and /etc/gitconfig) either by hand or using git-config(1). The [alias] section is used to create basic command aliases.

The /etc/gitshrc and ~/.gitshrc files are sourced (in that order) immediately before the shell becomes interactive.

The ~/.bashrc file is sourced before either /etc/gitshrc or ~/.gitshrc. Any bash customizations defined there and not explicitly overridden by git-sh are also available.

Copying

Copyright (C) 2008 Ryan Tomayko
Copyright (C) 2008 Aristotle Pagaltzis
Copyright (C) 2006, 2007 Shawn O. Pearce

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation.

git-sh's People

Contributors

ap avatar bmizerany avatar daenyth avatar mbrubeck avatar mgax avatar richardkmichael avatar rtomayko avatar xaviershay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-sh's Issues

Accept aliasses of hub

I installed hub and aliased it with git and this seems to play fine with git-sh. Except that certain new commands don't work. For example:

  • fork
  • pull-request
  • create
  • browse
  • compare

Others do work, like help hub. Can the new hub commands also be passed on?

chsh does not work

I really would like to chsh to git-sh on some development hosts.
But the command fails.

$ chsh
Cambio della shell di login di sergio
Inserire il nuovo valore o premere INVIO per quello predefinito
Shell di login [/bin/bash]: /usr/bin/git-sh
chsh: /usr/bin/git-sh is an invalid shell.
(The dialog is in italian, sorry, but the error message is in english)

Why git-sh is invalid?
Gentoo Linux.

Regards,
Sergio

Custom-formatted log alias fails when loading git sh

I have this:

lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

in my .gitconfig

It works great with bash, but when entering git sh, I get this error:

bash: eval: line 24: syntax error near unexpected token (' bash: eval: line 24:gitalias lg='git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative''

Any idea?

how to uninstall

yep,

it was great to test it.
since zsh provides me all I need, I'd like to uninstall git-sh.

How to do that ?

Provide an implementation for zsh

I'm leaning towards zsh recently and understand that git-sh does not work out of the box in that shell. I love git-sh's features in Bash that I would like to see a port for zsh.

(NB: For the most pat, I'm a shell noob, so if there's any easy way to make git-sh work in zsh please let me know!)

git-sh disables bash-completion for git

Starting git-sh seems to overwrite completion loaded from /usr/share/bash-completion/git

$ git-sh
master!repo *> commit [TAB]bash: completion: function `_git_commit' not found
master!repo *> commit [TAB]bash: completion: function `_git_commit' not found

.cproject      .includepath   .settings/     Release/       src/
.git/          .project       Debug/
master!repo *> commit --[TAB]bash: completion: function `_git_commit' not found
master!repo *> . /usr/share/bash-completion/git
master!repo *> commit --[TAB]
--all               --interactive       --signoff 
--amend             --message=          --template=
--author=           --no-verify         --untracked-files 
--cleanup=          --only              --untracked-files=
--dry-run           --quiet             --verbose 
--edit              --reedit-message=   --verify 
--file=             --reset-author      
--include           --reuse-message=    
master!repo *> commit --am[TAB]end

Feature: add numbers to file listings

Hey, Ryan -- this is a trick I use in SVN and grep, and I just wrote one for git:

http://github.com/aristus/giterate

Basically it adds a number to every file that appears in the status command, and allows you to reference them by number instead of name, ie "add 1 2 3" or "rm 4 9". It also lets you filter the status list by a regexp.

Feature: Make 'cd ~' go to project root directory

As this integrates into the users shell, I think it would be beneficial for the command 'cd ~' (which would usually cd to the users home directory) to cd to the projects root directory instead.

hash-object shortcut missing

For example:
master!hell *> hash-object daten
hash-object: command not found
master!hell *> git hash-object daten
23f1c24af4701670f6a5ce4f31b09dd68f2b2e26

Or just too unimportant?

Compiling on Cygwin

I wanted to compile and install Git-sh, but I have errors like this:

$ make
rm -f git-sh
cat git-sh.bash git-completion.bash  git-sh-aliases.bash git-sh-config.bash > git-sh+
bash -n git-sh+
git-sh+: line 54: syntax error near `$'{\r''
'it-sh+: line 54: `gitcomplete() {
Makefile:18: recipe for target `git-sh' failed
make: *** [git-sh] Error 2

cygcheck (cygwin) 1.7.10
GNU Make 3.82.90

I couldn't find any information about installing on Cygwin, is it possible?

Moving untracked files

I use git sh a lot these days to save me some keystrokes.

When I want to move some untracked files though using

master!project *> mv file1 file2

I get

fatal: not under version control, source=file1, destination=file2

Is there a workaround?

No alias for 'git push'?

git-sh.1.ronn has a "Fetching and Pulling" section, but I'm surprised to see no mention of "Pushing." ๐Ÿ˜„

My workaround for now is:

$ git config --global alias.pu 'push'

Is it intentional that there is no real mention of "push" within the git-sh codebase?

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.