threads / discuss / 9378

git-gui console app ?

Subject: git-gui console app ?

## tl;dr

14 messages between Aug 4, 2007 and Aug 11, 2007.

replies: 13people: 7as markdown or json

Erik Colson· Aug 4, 2007, 10:10 UTC · lore
Hello !

git-gui is a nice application and I like to use it while developping. However as probably a lot of developpers do, I regularly code in Emacs from a distant ssh client. Therefor I'd want to find some app like git-gui running in console... Does this exist or is there a project in development ?

Thanks for info
-- 
Erik
Johannes Schindelin· Aug 4, 2007, 11:29 UTC · re: Erik Colson · lore

Re: git-gui console app ?

Hi,
On Sat, 4 Aug 2007, Erik Colson wrote:
Show 5 quoted lines
> git-gui is a nice application and I like to use it while developping.
> However as probably a lot of developpers do, I regularly code in Emacs
> from a distant ssh client.
> Therefor I'd want to find some app like git-gui running in console...
> Does this exist or is there a project in development ?
There is tig.  http://repo.or.cz/w/tig.git

It is something similar to gitk but based on curses, so it is a viewer for now. But I do not see any fundamental reason why it should not be possible to teach it many of the tricks git-gui does.

Just fork it (you can even do that on repo.or.cz; tig.git is mirrored there), and give it a go!

Ciao, Dscho

Erik Colson· Aug 4, 2007, 11:53 UTC · re: Johannes Schindelin · lore

Re: git-gui console app ?

On Sat, Aug 04, 2007 at 12:29:03PM +0100, Johannes Schindelin wrote:
Show 18 quoted lines
> Hi,
> 
> On Sat, 4 Aug 2007, Erik Colson wrote:
> 
> > git-gui is a nice application and I like to use it while developping.
> > However as probably a lot of developpers do, I regularly code in Emacs
> > from a distant ssh client.
> > Therefor I'd want to find some app like git-gui running in console...
> > Does this exist or is there a project in development ?
> 
> There is tig.  http://repo.or.cz/w/tig.git
> 
> It is something similar to gitk but based on curses, so it is a viewer for 
> now.  But I do not see any fundamental reason why it should not be 
> possible to teach it many of the tricks git-gui does.
> 
> Just fork it (you can even do that on repo.or.cz; tig.git is mirrored 
> there), and give it a go!

Thanks for the very fast answer. I'm currently trying it out. However I can't figure out how to view the 'changed but not updated' in diff format... Any clue what I'm missing ?

-- 
Erik
Jeff King· Aug 4, 2007, 12:03 UTC · re: Erik Colson · lore

Re: git-gui console app ?

On Sat, Aug 04, 2007 at 01:53:31PM +0200, Erik Colson wrote:
> Thanks for the very fast answer. I'm currently trying it out. However
> I can't figure out how to view the 'changed but not updated' in diff
> format...
git-diff ?

By default, it will show the changes between your working tree and the index (i.e., changed but not updated). You can show the diff of "updated but not commited" with "git-diff --cached".

-Peff
Erik Colson· Aug 4, 2007, 12:38 UTC · re: Jeff King · lore

Re: git-gui console app ?

On Sat, Aug 04, 2007 at 08:03:42AM -0400, Jeff King wrote:
Show 11 quoted lines
> On Sat, Aug 04, 2007 at 01:53:31PM +0200, Erik Colson wrote:
> 
> > Thanks for the very fast answer. I'm currently trying it out. However
> > I can't figure out how to view the 'changed but not updated' in diff
> > format...
> 
> git-diff ?
> 
> By default, it will show the changes between your working tree and the
> index (i.e., changed but not updated). You can show the diff of "updated
> but not commited" with "git-diff --cached".
Peff,

yep that is the info I would like to browse in a way git-gui does it... showing a list of the files in the diff, and letting the user select a file to show the part of the diff for that file.

-- 
Erik
Junio C Hamano· Aug 4, 2007, 18:38 UTC · re: Erik Colson · lore

Re: git-gui console app ?

Erik Colson <eco@ecocode.net> writes:
Show 18 quoted lines
> On Sat, Aug 04, 2007 at 08:03:42AM -0400, Jeff King wrote:
>> On Sat, Aug 04, 2007 at 01:53:31PM +0200, Erik Colson wrote:
>> 
>> > Thanks for the very fast answer. I'm currently trying it out. However
>> > I can't figure out how to view the 'changed but not updated' in diff
>> > format...
>> 
>> git-diff ?
>> 
>> By default, it will show the changes between your working tree and the
>> index (i.e., changed but not updated). You can show the diff of "updated
>> but not commited" with "git-diff --cached".
>
> Peff,
>
> yep that is the info I would like to browse in a way git-gui does it...
> showing a list of the files in the diff, and letting the user select a
> file to show the part of the diff for that file.
Since you are an Emacs user, perhaps contrib/emacs/* would be
more to your taste?
 
Jeff King· Aug 5, 2007, 10:19 UTC · re: Erik Colson · lore

Re: git-gui console app ?

On Sat, Aug 04, 2007 at 02:38:34PM +0200, Erik Colson wrote:
Show 7 quoted lines
> > By default, it will show the changes between your working tree and the
> > index (i.e., changed but not updated). You can show the diff of "updated
> > but not commited" with "git-diff --cached".
> 
> yep that is the info I would like to browse in a way git-gui does it...
> showing a list of the files in the diff, and letting the user select a
> file to show the part of the diff for that file.

Ah, I see. There is a status mode for tig (tig -S), but you can't jump to the diff of a particular file. It shouldn't be that difficult to add for somebody familiar with the tig codebase, but I am not such a somebody.

Jonas, am I right that this should be a one-liner? If you can point me in the right direction, I can try to take a closer look, but I'm having trouble following the code.

-Peff
Jonas Fonseca· Aug 10, 2007, 13:31 UTC · re: Jeff King · lore

Re: git-gui console app ?

Jeff King <peff@peff.net> wrote Sun, Aug 05, 2007:
Show 18 quoted lines
> On Sat, Aug 04, 2007 at 02:38:34PM +0200, Erik Colson wrote:
> 
> > > By default, it will show the changes between your working tree and the
> > > index (i.e., changed but not updated). You can show the diff of "updated
> > > but not commited" with "git-diff --cached".
> > 
> > yep that is the info I would like to browse in a way git-gui does it...
> > showing a list of the files in the diff, and letting the user select a
> > file to show the part of the diff for that file.
> 
> Ah, I see. There is a status mode for tig (tig -S), but you can't jump
> to the diff of a particular file. It shouldn't be that difficult to add
> for somebody familiar with the tig codebase, but I am not such a
> somebody.
> 
> Jonas, am I right that this should be a one-liner? If you can point me
> in the right direction, I can try to take a closer look, but I'm having
> trouble following the code.

Not quite a one-liner, but I've implemented something that will show diffs of staged/unstaged changes as well as the content of untracked files when pressing Enter on a file in the status view. To update the status of a file (unstaged->staged, untracked->staged, etc) you now have to press 'u'.

Hope this helps.
-- 
Jonas Fonseca
Jeff King· Aug 10, 2007, 14:21 UTC · re: Jonas Fonseca · lore

Re: git-gui console app ?

On Fri, Aug 10, 2007 at 03:31:32PM +0200, Jonas Fonseca wrote:
Show 5 quoted lines
> Not quite a one-liner, but I've implemented something that will show
> diffs of staged/unstaged changes as well as the content of untracked
> files when pressing Enter on a file in the status view. To update the
> status of a file (unstaged->staged, untracked->staged, etc) you now
> have to press 'u'.

Nice. This was exactly what I had envisioned. Minor help text fixup is below.

-Peff

-- >8 -- status window: mention 'u' instead of Enter

Commits ca1d71ea and 89d917a bound the Enter functionality to 'u' (and Enter now shows the diff).

Signed-off-by: Jeff King <peff@peff.net>
---
 tig.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tig.c b/tig.c
index d9c9df8..40670e2 100644
--- a/tig.c
+++ b/tig.c
@@ -3156,15 +3156,15 @@ status_select(struct view *view, struct line *line)
 
 	switch (line->type) {
 	case LINE_STAT_STAGED:
-		text = "Press Enter to unstage file for commit";
+		text = "Press 'u' to unstage file for commit";
 		break;
 
 	case LINE_STAT_UNSTAGED:
-		text = "Press Enter to stage file for commit  ";
+		text = "Press 'u' to stage file for commit  ";
 		break;
 
 	case LINE_STAT_UNTRACKED:
-		text = "Press Enter to stage file for addition";
+		text = "Press 'u' to stage file for addition";
 		break;
 
 	case LINE_STAT_NONE:
-- 
1.5.2.4
Jonas Fonseca· Aug 11, 2007, 10:11 UTC · re: Jeff King · lore

Re: git-gui console app ?

Jeff King <peff@peff.net> wrote Fri, Aug 10, 2007:
Show 10 quoted lines
> On Fri, Aug 10, 2007 at 03:31:32PM +0200, Jonas Fonseca wrote:
> 
> > Not quite a one-liner, but I've implemented something that will show
> > diffs of staged/unstaged changes as well as the content of untracked
> > files when pressing Enter on a file in the status view. To update the
> > status of a file (unstaged->staged, untracked->staged, etc) you now
> > have to press 'u'.
> 
> Nice. This was exactly what I had envisioned. Minor help text fixup is
> below.

Thanks! I forgot to mention that I applied something like what you sent yesterday.

-- 
Jonas Fonseca
Erik Colson· Aug 10, 2007, 14:25 UTC · re: Jonas Fonseca · lore

Re: git-gui console app ?

On Fri, Aug 10, 2007 at 03:31:32PM +0200, Jonas Fonseca wrote:
Show 7 quoted lines
> Not quite a one-liner, but I've implemented something that will show
> diffs of staged/unstaged changes as well as the content of untracked
> files when pressing Enter on a file in the status view. To update the
> status of a file (unstaged->staged, untracked->staged, etc) you now
> have to press 'u'.
> 
> Hope this helps.

Works like a charm ! Thanks for the implementation. Btw, I'm using git (and tig) on MacosX and got it compiled by using the same remarks you mention for FreeBSD, so may be you could add this to the INSTALL document...

-- 
Erik
Jonas Fonseca· Aug 11, 2007, 10:22 UTC · re: Erik Colson · lore

Re: git-gui console app ?

On 8/10/07, Erik Colson <eco@ecocode.net> wrote:
Show 10 quoted lines
> On Fri, Aug 10, 2007 at 03:31:32PM +0200, Jonas Fonseca wrote:
> > Not quite a one-liner, but I've implemented something that will show
> > diffs of staged/unstaged changes as well as the content of untracked
> > files when pressing Enter on a file in the status view. To update the
> > status of a file (unstaged->staged, untracked->staged, etc) you now
> > have to press 'u'.
> >
> > Hope this helps.
>
> Works like a charm ! Thanks for the implementation.
Good to hear.

Now, I have to figure out how to clone git-gui's ability to stage individual diff (c)hunks ... :)

> Btw, I'm using
> git (and tig) on MacosX and got it compiled by using the same remarks
> you mention for FreeBSD, so may be you could add this to the INSTALL
> document...

Yes, it might be a good idea to add it, but I would like to add a configure script to figure this sort of thing out automatically.

-- 
Jonas Fonseca
David Kågedal· Aug 7, 2007, 14:21 UTC · re: Erik Colson · lore

Re: git-gui console app ?

Erik Colson <eco@ecocode.net> writes:
Show 7 quoted lines
> Hello !
>
> git-gui is a nice application and I like to use it while developping.
> However as probably a lot of developpers do, I regularly code in Emacs
> from a distant ssh client.
> Therefor I'd want to find some app like git-gui running in console...
> Does this exist or is there a project in development ?

If you are already using emacs, why not use the emacs frontend? It isn't as featureful as git gui right now, but it integrates better with your emacs.

-- 
David Kågedal
Erik Colson· Aug 7, 2007, 15:18 UTC · re: David Kågedal · lore

Re: git-gui console app ?

On Tue, Aug 07, 2007 at 04:21:06PM +0200, David Kågedal wrote:
> If you are already using emacs, why not use the emacs frontend?  It
> isn't as featureful as git gui right now, but it integrates better
> with your emacs.

I'm actually using git-status in Emacs. But I'd like to access repo diffs in a gui like tig. It's quite nice excepted that I can't figure out how to show the result of git-diff --cached

-- 
Erik

← back to recent threads