Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming

A Dedicated Shell For Git Commands 96

Nw submitter CMULL writes "Stop typing Git over and over again. Ruby on Rails development and consulting firm thoughtbot created an interactive shell dedicated to Git commands, gitsh. One of the primary developers says there is a need for this shell because many early Unix utilities don't take sub-commands like Git."
This discussion has been archived. No new comments can be posted.

A Dedicated Shell For Git Commands

Comments Filter:
  • Is it gitish or gitsh?
  • by AndroSyn ( 89960 ) on Tuesday February 11, 2014 @12:01PM (#46218795) Homepage

    alias gstatus='git status'
    alias gcommit='git commit'

    Or whatever other commands you want? I don't see the need for a purpose built shell when aliases would work just fine?

    Some people just want to overengineer things I guess...

  • by godrik ( 1287354 ) on Tuesday February 11, 2014 @12:02PM (#46218823)

    I am using git all the time. But most of the time, I am doing less than 5 different commands. Why would you need a shell for that?

  • by Anonymous Coward on Tuesday February 11, 2014 @12:08PM (#46218895)

    The developer in the article does not "say there is a need for this shell because many early Unix utilities don't take sub-commands", as the summary says. Rather, he motivates the idea of gitsh by comparing it to utilities which act in a shell-like manner (he picks dc as an example): if it works for them, why not for git too?

    The first version (from the summary) makes no sense; the second version (from the article) seems like a reasonable argument to me.

    Rather than fucking beta, how about we try to get the fucking summaries correct?

  • Or you could just use an IDE like Vim, Eclipse, NetBeans, etc. that can handle git via plugins. If you are using git enough that you need an interactive shell, you might as well just integrate it with your development enviroment.

    • by Luthair ( 847766 )
      To me the git integrations in IDEs have never felt quite right, CVS and SVN were great but something doesn't quite fit for the git workflow so I still use cli/gitk/gui 4-years later.
      • To me the git integrations in IDEs have never felt quite right, CVS and SVN were great but something doesn't quite fit for the git workflow so I still use cli/gitk/gui 4-years later.

        Agree 100% in the case of Eclipse on Windows. Get all kinds of spurious commits involving line endings. So I just drop into a cygwin shell for commits.

        • Edit your eclipse settings to insert only Unix-style line endings (I think under formatting rules and editor preferences) and if you have legacy code, use the "convert line delimeters to" item in the file menu.
    • I use the JetBrain IDEs and the integrated one works well for 99% of the stuff I use it for (commits, pushes, pulls, merges, branches, rebase, history). Of course there is that 1% of the time where I need to run a git command that isn't supported. But luckily they also have an integrated terminal so just open that and I am put straight into the working directory.
    • Dunno 'bout the others, but I've felt that git integration with eclipse is kludgy and awkward to use.
  • It's three letters (Score:5, Insightful)

    by Arancaytar ( 966377 ) <arancaytar.ilyaran@gmail.com> on Tuesday February 11, 2014 @12:11PM (#46218925) Homepage

    Effort-wise, switching into and out of a git-specific shell just to save those three letters is a huge hassle and not worth it. (The tab completion thing is not an advantage; regular git already does that in bash.)

    For any actual development work you'll keep using both git and non-git commands; opening text editors, diffing and patching outside git, running scripts and shell snippets or sed commands. How do you pass those out of the git shell? Using an exclamation mark, like in ed? That really just inverts the problem, adds the problem of remembering whether you're currently in gitsh or bash, and adds confusion between the two environment variable scopes.

    • by rok3 ( 1133003 )
      This.

      I don't know why this has made it to every programming news site I visit.
    • Technically, 4.

      Unless your shell will somehow interpret gitcommit as 'git commit' ;)

      • by Anonymous Coward

        Technically, it's 3 letters but 4 characters.

        Unless yous shell will somehow interpret gitfcommit as 'git commit' ;)

    • The main improvement, as far as I can tell, it does tab auto-complete on commands, branch names, and paths. A normal shell won't give you tab auto-complete on branch names.
      • Well, some shell does. They have had the ability to extend auto-completion for some time. Not to say that it's not needed (I'm part of the peoples that use only 3-4 git commands) but writting scripts that handle git auto completion in existing shell might be more useful in the wide than a git-centric new shell.
      • by Splab ( 574204 )

        zsh does out of the box.

    • I see this as something you'd use if you tend to work in a GUI that's just full of terminals. You can keep a gitsh terminal open and easily switch over to it to run git commands without having to drop out of something else.

  • gitshell (Score:5, Funny)

    by defaria ( 741527 ) <Andrew@DeFaria.com> on Tuesday February 11, 2014 @12:15PM (#46218969) Homepage
    $ while true; do
    > echo -n "GitShell:"
    > read command
    > git $command
    > done

    Well that was easy!

  • Web developer here and used git for last 2 years on a daily basis.

    Gitsh looks promising, but I will hold my verdict until I use it for an extended period, and see how it can improve my work life.

    Currently I use a combination of SmartGit and Git Bash. SmartGit is mainly used in visualizing branch history, resolve conflicts, tagging and do some odd jobs here and there e.g. edit message of the last commit. Git Bash is used for checking out branches, merging, pulling, pushing sort of stuff i.e. any operation th

    • If you're using git bash, this really isn't for you anyways. You already have to run a "specialized" shell just to use it - why run another shell inside that one?

      This is meant for people running operating systems that come with functional shells as-they-are.

  • If it doesn't, I don't see how it saves much typing.

    $ vim -p file1.c file2.c file3.c
    $ make
    $ ./a.out
    $ gitsh
    @ add file1.c file2.c file3.c
    @ commit -m 'some crap'
    @ ^D

    $ vim -p file1.c file2.c file3.c
    $ make
    $ ./a.out
    $ git add file1.c file2.c file3.c
    $ git commit -m 'some crap'

    Net savings of what, one keypress? It's rare for me to issue more than one or two git commands without issuing a non-git command. Unless the intention is to have a seperate shell up that you switch to whenever you need to do get stuff, maybe?

    I

  • by Anonymous Coward

    Good idee, and it works too, but TFA is not the first attempt at doing so: https://github.com/rtomayko/git-sh

    I have been this rtomayko's solution for a year now, and the shell combined with a decent set of shorthand aliases that come with the shell, do improve my workflow a lot. I can recommend it to anyone who uses git on a daily basis.

  • I have been using Giteye ( http://www.collab.net/giteyeap... [collab.net] ) to manage my git repositories, it is very powerful and full featured. I particularly like its merge tool. I don't type git commands anymore except when I am making some kind of script that needs to get stuff into or out of git. It also integrates painlessly with github and many other Issue tracking tools.

    There are a few disadvantages in using it though:
    1) You have to learn how to do stuff you already know how to do in the CLI (mildly annoying).
    2

  • Mark as duplicated (Score:5, Informative)

    by RockoW ( 883785 ) on Tuesday February 11, 2014 @12:50PM (#46219368) Homepage
    There is already a git-sh [github.io] . It even have a debian package included on the main repos.
  • Wish people would develop an xterm or cygwin term specifically designed to select the sha check sum. I want to click or double click on a line and I want it to select a sha check sum if displayed on that line. Or default to selecting full line if nothing that looks like a sha check sum is found on that line.

    I don't want to pay for the overhead of a full fledged GUI. I like the speed of command line thank you very much. But picking the check sum to do cherry picks is a pain. Especially for me stuck in a st

    • by spitzak ( 4019 )

      Double-click on SHA numbers seems to work fine for me, I use it all the time.

    • by xaxa ( 988988 )

      "gitk" came with MSysGit (when I last used it), and you can right-click commits and choose "cherry pick".

      "git gui" also works.

    • You need to run sshd under cygwin and use Putty to easily double-click to select a sha sum (enable X11 mode for select=copy and middle-click=paste).

  • As others have commented I think this idea can be covered with some simple aliases in bash, seems a tad silly.

    What I wish was available was a way to view the source of a git with one minor enhancement - the ability to browse with a click to the declaration/definition of functions/variables a la the IDE of your choice. Would be neat to be able to build an index using some tool, check it into the root of your repo, and then have the site use the index to mark up the source code with the appropriate links.

    I
    • OpenGrok
    • by jgrahn ( 181062 )

      What I wish was available was a way to view the source of a git with one minor enhancement - the ability to browse with a click to the declaration/definition of functions/variables a la the IDE of your choice. Would be neat to be able to build an index using some tool, check it into the root of your repo, and then have the site use the index to mark up the source code with the appropriate links. I've dug around for something that does this but haven't found anything suitable - anyone know of anything?

      Sound

      • Yeah, I really want to be able to do it right in the browser - I started wanting it the other day when I was sitting in the waiting room at my kid's ballet class and trying to debug an issue on my phone by looking at the code on github.com. It would have been 100 times easier if I'd been able to click on method names/classes and jump to the declarations, or even search for references right in the browser. Wondering if I can find where/how eclipse stores it's project indices and roll my own...

        Thanks for t
  • So is it too late to make a comment saying one should make their own shell, with blackjack and hookers, only forget the shell and the blackjack?
  • Bash is very good, but much could be done to craft a better command shell that combines the best of Bash, Perl, Ruby and Python, with the only bit of Visual Basic that I really liked: the with construct.

    In Visual Basic, one could write
    with myObject .this := that .and := other
    end with

    The dots at the start are redundant given proper block structure, unless you also have a smalltalk like messaging facility that runs aside C++ style getters and setters. Then .this = that style constructs would do low level get and set, and
    with git
        init
        add .
        commit -m "initial commit"
        end
    which is fine provided 'git end' has no meaningful value to git.

    I'm also thinking about the consequences of replacing the environment with stacks of dictionaries, and playing with simple prototypes in Python, sometimes just half writing them to help me see how the code would look.

    • by xaxa ( 988988 )

      The dots aren't redundant:

      Dim x

      With y
          x = 1 ' Which x?
      End with

      But, as someone wrote up there ^^, you could use a while loop:
      $ while true; do
      > echo -n "GitShell:"
      > read command
      > git $command
      > done

  • The mistake with the thesis of the authors is to think that little tools with built in shells to handle subcommands (dc, ftp etc) are generally not horrible. They are horrible and reproducing their interface mistake for git is also a mistake of the same type.

  • Does it support completion of git commands like bash does with some bash_completion functions?

  • by Flammon ( 4726 )

    The command line is great but sometimes a GUI comes along and makes things so much easier, especially to cherry pick.

    gitg [gnome.org]

You knew the job was dangerous when you took it, Fred. -- Superchicken

Working...