Slashdot Mirror


A Dedicated Shell For Git Commands

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."

96 comments

  1. Typo? by parallel_prankster · · Score: 1

    Is it gitish or gitsh?

    1. Re:Typo? by wonkey_monkey · · Score: 1

      Maybe the submitter thought he'd made a joke. Y'know - take my wife, please *gitish*

      --
      systemd is Roko's Basilisk.
    2. Re:Typo? by Anonymous Coward · · Score: 0

      Do I win because I'm using GIT on TFS?

    3. Re:Typo? by Anonymous Coward · · Score: 0

      Is it gitish or gitsh?

      Timmiy.

    4. Re:Typo? by escherblacksmith · · Score: 1

      funny, she doesn't look gitish . . .

    5. Re:Typo? by Anonymous Coward · · Score: 0

      They should call it lazygit.

    6. Re:Typo? by durin · · Score: 1

      I really think it "glitch".

      --
      Why, yes! I AM new here.
  2. Git cannot be used by Anonymous Coward · · Score: 0

    It doesn't work.

    1. Re:Git cannot be used by Anonymous Coward · · Score: 0

      What do you mean?

    2. Re:Git cannot be used by Anonymous Coward · · Score: 0

      GIT the fuck out you beta lover!!!

    3. Re:Git cannot be used by Anonymous Coward · · Score: 0

      Only if you're a gitiot.

    4. Re:Git cannot be used by Mitchell314 · · Score: 1

      You misspelled "cvs".

      --
      I read TFA and all I got was this lousy cookie
  3. why not just use shell aliases? by AndroSyn · · Score: 5, Informative

    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...

    1. Re:why not just use shell aliases? by phantomfive · · Score: 5, Insightful

      "Those who fail to understand Unix are doomed to reimplement it, poorly."

      --
      "First they came for the slanderers and i said nothing."
    2. Re:why not just use shell aliases? by putaro · · Score: 1

      Kids these days.

    3. Re:why not just use shell aliases? by gabereiser · · Score: 1

      omg this! Mod's, give this man some points!

    4. Re:why not just use shell aliases? by TheCarp · · Score: 1

      This is exactly what I was thinking. However, there is one reason: So you can make it a restricted login shell that can only issue git commands or git plus some small subset.

      Other than that, beats me, I can't imagine any other scenarios where aliases wouldn't be good enough.

      --
      "I opened my eyes, and everything went dark again"
    5. Re:why not just use shell aliases? by Anonymous Coward · · Score: 0

      omg this!

      Is this the first time you've encountered that saying? You seem just a bit over-enthusiastic.

    6. Re:why not just use shell aliases? by Zeromous · · Score: 2

      Some people just want an OSS contribution on their resume I suggest.

      --
      ---Up Up Down Down Left Right Left Right B A START
    7. Re: why not just use shell aliases? by Anonymous Coward · · Score: 0

      Well hey, it's some Ruby on Rails posse... Wheel must be reinvented. What did you expect?

      How hard is it to do those aliases and then use tab completion in the regular shell... Hint: not hard at all, besides it was a rhetorical question, you hipster.

    8. Re:why not just use shell aliases? by Mitchell314 · · Score: 0

      Whereas those who do understand Unix are doomed to teach it.

      --
      I read TFA and all I got was this lousy cookie
    9. Re:why not just use shell aliases? by Anonymous Coward · · Score: 0

      I hate typing, so I just use 'g-' as my git alias prefix: even less typing than with gitsh!

      From my .profile:

      if type git >& /dev/null; then
              alias g-s='git status'
              alias g-l='git log --stat'
              alias g-lo='git log --oneline'
              alias g-ll='git log --stat master..HEAD'
              alias g-llo='git log --oneline master..HEAD'
              alias g-lu='git log --stat origin/master'
              alias g-luo='git log --oneline origin/master'
              alias g-d='git diff'
              alias g-dl='git diff master..HEAD'
              alias g-f='git fetch -v'
              alias g-co='git checkout'
              alias g-a='git add'
              alias g-r='git reset'
              alias g-c='git commit'
              alias g-aac='git add -A; git commit'
              alias g-us='git push'
              alias g-ull='git pull'
              alias g-ulff='git pull --ff-only'
              alias g-b='git branch'
              alias g-m='git merge'
              alias g-mff='git merge --ff-only'
              alias g-rb='git rebase'
              alias g-rbi='git rebase -i'
      fi

    10. Re:why not just use shell aliases? by Anonymous Coward · · Score: 0

      *cough* docker *cough*

    11. Re:why not just use shell aliases? by Alex+Zepeda · · Score: 1

      Don't forget the tab completion and sh prompt integration.

      https://github.com/git/git/tre...

      --
      The revolution will be mocked
    12. Re:why not just use shell aliases? by Anonymous Coward · · Score: 0

      How do you type - quickly? It's all the way over there.

    13. Re:why not just use shell aliases? by Anonymous Coward · · Score: 0

      Yep, got 20+ aliases I use daily, many of them have two lines worth of arguments in them. I use those primarily for "oh shit" moments when something goes awry (can happen with new developers or the un-gitsavvy)

    14. Re:why not just use shell aliases? by IllusionalForce · · Score: 1

      The systemd guys clearly don't understand unix and they're not even close to reimplementing it, though.

  4. I don't see the point by godrik · · Score: 3, Insightful

    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?

    1. Re:I don't see the point by Bryan+Ischo · · Score: 2

      There is a pompus ass here, but I'm pretty sure it's not the O.P. And I don't think it's me either ...

    2. Re:I don't see the point by OverlordQ · · Score: 1

      They're a Ruby on Rails shop, what were you expecting?

      --
      Your hair look like poop, Bob! - Wanker.
  5. Git outta here BETA! by Anonymous Coward · · Score: 0, Funny

    Betaaaa!!!! I hate theeeee!!!!!

  6. Comprehension Failure by Anonymous Coward · · Score: 5, Informative

    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?

    1. Re:Comprehension Failure by Anonymous Coward · · Score: 0

      who is "we"?

      you are NOTHING.

      slashdot = stagnated

    2. Re:Comprehension Failure by Anonymous Coward · · Score: 0

      And yet, you're still here, and willing to comment!

  7. Or just use an IDE by inhuman_4 · · Score: 1

    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.

    1. Re:Or just use an IDE by Luthair · · Score: 2

      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.

    2. Re:Or just use an IDE by Anonymous Coward · · Score: 0

      I agree. In fact I think the IDEs actually make version control with git more difficult and tedious.

    3. Re:Or just use an IDE by master_kaos · · Score: 1

      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.

    4. Re:Or just use an IDE by Anonymous Coward · · Score: 0

      From my experiences primarily with vim, I agree. I've never bothered with using shell commands inside vim unless it's a trivial one-liner or I'm writing the output into the buffer.

    5. Re:Or just use an IDE by Slashdot+Parent · · Score: 1

      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.

      --
      They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock
    6. Re:Or just use an IDE by sanosuke001 · · Score: 1

      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.

      --
      -SaNo
    7. Re:Or just use an IDE by Mitchell314 · · Score: 1

      Dunno 'bout the others, but I've felt that git integration with eclipse is kludgy and awkward to use.

      --
      I read TFA and all I got was this lousy cookie
    8. Re:Or just use an IDE by Anonymous Coward · · Score: 0

      When developing on Windows, the VERY FIRST STEP you should do when setting up your IDE/editor is using LF line endings. If you don't, you are guaranteed to be hated by any other dev who touches your work.

      I've taught this to way too many developers, but their salary capability increased by at least 10% with this knowledge.

  8. Linux by Anonymous Coward · · Score: 0

    Does it run on linux?

  9. It's three letters by Arancaytar · · Score: 4, Insightful

    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.

    1. Re:It's three letters by rok3 · · Score: 1

      This.

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

    2. Re:It's three letters by X0563511 · · Score: 1

      Technically, 4.

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

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    3. Re:It's three letters by phantomfive · · Score: 1

      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.

      --
      "First they came for the slanderers and i said nothing."
    4. Re:It's three letters by Anonymous Coward · · Score: 0

      Bash with bash-completion does give auto-complete on branch names.

    5. Re:It's three letters by Cley+Faye · · Score: 1

      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.

    6. Re: It's three letters by BitZtream · · Score: 1

      Since when? Doesn't for me, I'm running FBSD 10, and OSX, neither seem to magically know.

      Mind you, I just started using git a few weeks ago to interact with a github hosted project, but I've been using subversion and cvs for 10 years at least. I may just be ignorant of something I have to do to get it to know about the branches?

      --
      Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
    7. Re:It's three letters by Splab · · Score: 1

      zsh does out of the box.

    8. Re:It's three letters by wolrahnaes · · Score: 1

      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.

      --
      I used to get high on life, but I developed a tolerance. Now I need something stronger.
    9. Re: It's three letters by jordan_robot · · Score: 1

      Git completion here: https://github.com/git/git/blo...

  10. gitshell by defaria · · Score: 5, Funny
    $ while true; do
    > echo -n "GitShell:"
    > read command
    > git $command
    > done

    Well that was easy!

    1. Re:gitshell by jones_supa · · Score: 1

      Brilliant. :)

  11. Because making actual things is haaaaaaaard by Anonymous Coward · · Score: 0

    So we're taking issue with interface design so that we can convince people that a wrapper around an existing tool is actually worth paying attention to instead of . . . y'know . . .actually contributing something?

  12. Give it time by Mateo_LeFou · · Score: 3, Interesting

    They have to build a custom shell so that later it can be hosted as a service.

    --
    My turnips listen for the soft cry of your love
  13. looks promising by nerdyalien · · Score: 1

    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 that is more straight forward on the command line, which I happened to feel "clunky" on SmartGit.

    Overall, my underline philosophy is, developers should not spend lot of time in version control related tasks, rather should resort to many tools if necessary to expedite it and move on with tackling big problems i.e. features, bug smashing, optimising.

    1. Re:looks promising by X0563511 · · Score: 1

      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.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
  14. Does it let you run non-git commands, as well? by thevirtualcat · · Score: 1

    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 tried to install it and verify for myself, but it required a newer version of Ruby than is available on my distribution. (Thanks, Canonical.)

    1. Re:Does it let you run non-git commands, as well? by Anonymous Coward · · Score: 0

      Maybe, like other interpreters, it supports a '-e' flag to pass in the command to execute on the command line, so your 'add file1.c file2.c file3.c' could be rewritten:

      gitsh -e 'add file1.c file2.c file3.c'

      :-)

  15. Already done before though by Anonymous Coward · · Score: 1

    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.

  16. Giteye by Daniel+Hoffmann · · Score: 1

    I have been using Giteye ( http://www.collab.net/giteyeap... ) 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) You need to create a free account on a service to continue using it after a month (a little annoying).
    3) It is build on top of eclipse though, so it consumes a few hundred megabytes of memory (very annoying if you have an underpowered machine).

    1. Re:Giteye by Slashdot+Parent · · Score: 1

      You might want to give Atlassian SourceTree a try. Also free-as-in-beer, but a little lighter-weight. I find it's pretty nice.

      --
      They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock
    2. Re:Giteye by Daniel+Hoffmann · · Score: 1

      Looks pretty good, but I already learned Giteye. How does it hold up against Giteye? any killer features?

    3. Re:Giteye by Slashdot+Parent · · Score: 1

      Looks pretty good, but I already learned Giteye. How does it hold up against Giteye? any killer features?

      Beats me. I've never used giteye. Just thought I'd pass along the tip.

      --
      They don't grade fathers, but if your daughter's a stripper, you fucked up. --Chris Rock
  17. Mark as duplicated by RockoW · · Score: 5, Informative

    There is already a git-sh . It even have a debian package included on the main repos.

    1. Re:Mark as duplicated by Anonymous+Cod · · Score: 1

      I was looking for someone to have mentioned this. I've been using git-sh for years.

    2. Re:Mark as duplicated by laddiebuck · · Score: 1

      Not to mention, git-sh seems far more useful (succinct, and doesn't use any weird syntax) than this one.

  18. None of this would be necessary by Anonymous Coward · · Score: 0

    If Git wasn't a steaming pile of shit, kind of like Beta.

  19. dogit by Anonymous Coward · · Score: 0

    alias such=git
    alias very=git
    alias wow='git status'

     

    1. Re:dogit by nitehawk214 · · Score: 1

      You are using doge shell.

      --
      I'm a good cook. I'm a fantastic eater. - Steven Brust
  20. Anonymous Coward by Anonymous Coward · · Score: 1

    Technically, it's 3 letters but 4 characters.

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

  21. because... by znrt · · Score: 2

    ... aliases are not new. you must come up with something newish to hit the headlines.

  22. What we need is not a shell, but sha picker. by 140Mandak262Jamuna · · Score: 1
    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 stupid cygwin terminal in a Win7 box.

    Developing the idea further, some kind of graphical/mouse pick from the output of git log --format="%h %an %s" origin/master..my_bug_fix_branch in a regular console window would be great. I would like to right-click on a line in a console window and get a context menu under the mouse cursor. The line under the cursor should be parsed and broken into %d %n %an etc be available to the git commands in the context menu.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    1. Re:What we need is not a shell, but sha picker. by spitzak · · Score: 1

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

    2. Re:What we need is not a shell, but sha picker. by xaxa · · Score: 1

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

      "git gui" also works.

    3. Re:What we need is not a shell, but sha picker. by nullchar · · Score: 1

      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).

  23. Shell? Give me a web based browser by jomama717 · · Score: 1

    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've dug around for something that does this but haven't found anything suitable - anyone know of anything?

    --
    while [ 1 ]; do echo -n -e "\xe2\x95\xb$((($RANDOM&1)+1))"; done
  24. Too late? by jythie · · Score: 1

    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?

  25. What you need is a new command shell by John+Allsup · · Score: 2

    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.

    --
    John_Chalisque
    1. Re:What you need is a new command shell by xaxa · · Score: 1

      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

  26. But built in shells are generally horrible. by TechyImmigrant · · Score: 1

    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.

    --
    I should use this sig to advertise my book ISBN-13 : 978-1501515132.
  27. Completions? by srk · · Score: 1

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

  28. Up arrow by Anonymous Coward · · Score: 0

    Who types commands? I use the up arrow. (I use svn, not git, but it's the same thing.) Type it once, and use command-line recall.

  29. gitg by Flammon · · Score: 1

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

    gitg

  30. Should do it automatically in bash by Arancaytar · · Score: 1

    Seems to work out of the box in debian jessie and Ubuntu 12.04+ at the very least. It installs a script in /etc/bash_completion.d/git that reads the branch list straight from the .git/ subfolder in the current repository.

  31. Woohoo! by Anonymous Coward · · Score: 0

    Shazbot! We ran into some trouble getting the comments.
    Try again... na-nu, na-nu!

    FUCK BETA!

  32. sudo also needs a shell by Anonymous Coward · · Score: 0

    While they are at it, they should make a shell so we don't have to type sudo all the time.
    Bonus points if they make it so I don't have to type "bash -c" in front of all my commands.

  33. Re:Shell? Give me a web based browser by 19thNervousBreakdown · · Score: 1

    OpenGrok

    --
    <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
  34. Re:Shell? Give me a web based browser by jgrahn · · Score: 1

    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?

    Sounds like plain old etags/ctags. You may have to look at the commit from inside your editor though for that to work, e.g. an Emacs M-x shell.

  35. Re:Shell? Give me a web based browser by jomama717 · · Score: 1

    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 the reply!

    --
    while [ 1 ]; do echo -n -e "\xe2\x95\xb$((($RANDOM&1)+1))"; done