Open derkling opened 5 years ago
Yes, you're missing that I had not heard about tig before you mentioned it above ;-). Thank you I will try it!
Joel, add color to it spice up...just for visually attract the end-user...you know... :)
Well, I am a big fan of tig and I have been using it for so long...
Tig is not working well for me. For one, I want to scroll to a patch and hit a single key to edit.
With mine I simply scroll to the patch in the one-line list and hit a single key which opens vim. With Tig I have to first scroll to the patch, then hit enter, then hit J a couple of times, and then hit E. That's too long. I might fix Tig but currently my stupid git-edit works quite well for me, so I don't know...
BTW I might rename git-edit to ngit...
Patches welcomed of course... This is just a combination of bash and python... Not complex code base like tgit..
I have a better ncurses frontend prepared but I haven't integrated it with git-edit yet.
Looking that this has got some interest, I might improve it and actually post some screenshots ;-)
Also in other thoughts, I want to integrate this with mutt so I can also send patches from it...fwiw
I have a better ncurses frontend prepared but I haven't integrated it with git-edit yet.
Bring it on Joel!
Also in other thoughts, I want to integrate this with mutt so I can also send patches from it...fwiw
I think you get the most blessing from Greg alone !!
@unixbhaskar updated it with some colors, and detailed help message if you press 'h', and a detailed README with some screenshots.
What do you think? ;-) Do you have a chance to test it for me?
Sure
@unixbhaskar updated it with some colors, and detailed help message if you press 'h', and a detailed README with some screenshots.
What do you think? ;-) Do you have a chance to test it for me?
Okay, give it a spin...and looks good. One thing I personally prefer or might help it go better is , please put the "lib" in standard FHS location i.e under /lib ...so people can access that binary from standard location then the pull-down repo dir. For instance, at present the binary/script expects the lib directory to be lived in the same place, which should be changed.
I have changed that in the script ...very trivial ...and it's working fine ...and I don't have access to send PR to you...so you can...exactly 3 line changes...variable $spath has to be set right.
So, end-user can type it from any git repo...without being worried about the lib location ..I know I can be done with an alias...but this would be more precise.
Not sure am I thinking in the same way what you did when you wrote this...curse me if that is the case.
Tig is not working well for me. For one, I want to scroll to a patch and hit a single key to edit.
With mine I simply scroll to the patch in the one-line list and hit a single key which opens vim. With Tig I have to first scroll to the patch, then hit enter, then hit J a couple of times, and then hit E. That's too long. I might fix Tig but currently my stupid git-edit works quite well for me, so I don't know...
With just a bit of tig-fu, you can do the same by adding this to your .tigrc
:
bind main E !git-amend-sha1 %(commit)
where git-amend-sha1
is just this small scriptlet in your PATH:
#!/bin/bash
SHA1=$1
HEAD=$(git rev-parse HEAD)
git reset --hard $SHA1 && \
git commit --amend && \
git cherry-pick $SHA1..$HEAD >/dev/null
which makes it handy to use it from command line too.
Tig is not working well for me. For one, I want to scroll to a patch and hit a single key to edit.
With mine I simply scroll to the patch in the one-line list and hit a single key which opens vim. With Tig I have to first scroll to the patch, then hit enter, then hit J a couple of times, and then hit E. That's too long. I might fix Tig but currently my stupid git-edit works quite well for me, so I don't know...
BTW I might rename git-edit to ngit...
Patches welcomed of course... This is just a combination of bash and python... Not complex code base like tgit..
Using magit that's
magit-status
-> r
(for rebase) -> w
(for reword).
Pick the commit you want to reword, reword as you wish, and once you're done (C-c C-c
on vanilla emacs) the whole rebase is done for you.
It's Magit!
Tig is not working well for me. For one, I want to scroll to a patch and hit a single key to edit. With mine I simply scroll to the patch in the one-line list and hit a single key which opens vim. With Tig I have to first scroll to the patch, then hit enter, then hit J a couple of times, and then hit E. That's too long. I might fix Tig but currently my stupid git-edit works quite well for me, so I don't know...
With just a bit of tig-fu, you can do the same by adding this to your
.tigrc
:bind main E !git-amend-sha1 %(commit)
where
git-amend-sha1
is just this small scriptlet in your PATH:#!/bin/bash SHA1=$1 HEAD=$(git rev-parse HEAD) git reset --hard $SHA1 && \ git commit --amend && \ git cherry-pick $SHA1..$HEAD >/dev/null
which makes it handy to use it from command line too.
That's handy dandy! But I get an annoying 'Press any key to continue'.
What I have is working well for me, and not sure I want to switch to rcfiles, separate scripts, or have enough time to be limited by, or care too much about another tool. But I will keep this issue open, for the on lookers to know the alternatives! Again, YMMV! And I mentioned tig in the README.md fwiw. Thanks!
Tig is not working well for me. For one, I want to scroll to a patch and hit a single key to edit. With mine I simply scroll to the patch in the one-line list and hit a single key which opens vim. With Tig I have to first scroll to the patch, then hit enter, then hit J a couple of times, and then hit E. That's too long. I might fix Tig but currently my stupid git-edit works quite well for me, so I don't know... BTW I might rename git-edit to ngit... Patches welcomed of course... This is just a combination of bash and python... Not complex code base like tgit..
Using magit that's
magit-status
->r
(for rebase) ->w
(for reword).Pick the commit you want to reword, reword as you wish, and once you're done (
C-c C-c
on vanilla emacs) the whole rebase is done for you.It's Magit!
I lost you when you mentioned emacs ;-) ;-)
@unixbhaskar updated it with some colors, and detailed help message if you press 'h', and a detailed README with some screenshots. What do you think? ;-) Do you have a chance to test it for me?
Okay, give it a spin...and looks good. One thing I personally prefer or might help it go better is , please put the "lib" in standard FHS location i.e under /lib ...so people can access that binary from standard location then the pull-down repo dir. For instance, at present the binary/script expects the lib directory to be lived in the same place, which should be changed.
I have changed that in the script ...very trivial ...and it's working fine ...and I don't have access to send PR to you...so you can...exactly 3 line changes...variable $spath has to be set right.
So, end-user can type it from any git repo...without being worried about the lib location ..I know I can be done with an alias...but this would be more precise.
Not sure am I thinking in the same way what you did when you wrote this...curse me if that is the case.
Hmm, I think I lost you. All you need to do is point $PATH
to the location of your git repo, then say ngit
. There should not be any need to move lib
to anywhere.
That's handy dandy! But I get an annoying 'Press any key to continue'.
This can be avoided by pre-pending > to command. See https://github.com/jonas/tig/issues/463
I found tig super helpful, able to accomplish most things. Here with external commands for things that I use most often, by adding following in tigrc:
bind main A !>sh -c "GIT_SEQUENCE_EDITOR=\"sed -i -e '1 s/^pick /reword /'\" git rebase -i %(commit)^ --autostash"
bind main E !<>sh -c "GIT_SEQUENCE_EDITOR=\"sed -i -e '1 s/^pick /edit /'\" git rebase -i %(commit)^ --autostash"
bind main D !>sh -c "GIT_SEQUENCE_EDITOR=\"sed -i -e '1 s/^pick /drop /'\" git rebase -i %(commit)^ --autostash"
bind main F !>sh -c "git commit --fixup=%(commit) && GIT_SEQUENCE_EDITOR=true git rebase -i %(commit)^ --autostash --autosquash"
Thanks Adrian, I may still stick to my duct-tape shell scripts in case I am unable to fully transition but I will give your ideas a shot! However, if tig does most of what this git project does; I would just take this github project offline.
Anyway, I am now using tig about 20% of the time and my favorite usecase is jumping to files in unstaged changes.
Thanks again and glad to see that my toy project triggered this discussion which taught me something ;)
That's handy dandy! But I get an annoying 'Press any key to continue'.
This can be avoided by pre-pending > to command. See jonas/tig#463
I found tig super helpful, able to accomplish most things. Here with external commands for things that I use most often, by adding following in tigrc:
bind main A !>sh -c "GIT_SEQUENCE_EDITOR=\"sed -i -e '1 s/^pick /reword /'\" git rebase -i %(commit)^ --autostash"
Works.
bind main E !<>sh -c "GIT_SEQUENCE_EDITOR=\"sed -i -e '1 s/^pick /edit /'\" git rebase -i %(commit)^ --autostash"
Works.
bind main D !>sh -c "GIT_SEQUENCE_EDITOR=\"sed -i -e '1 s/^pick /drop /'\" git rebase -i %(commit)^ --autostash"
Works.
bind main F !>sh -c "git commit --fixup=%(commit) && GIT_SEQUENCE_EDITOR=true git rebase -i %(commit)^ --autostash --autosquash"
This requires staging commits. Why not 'git commit -as --fixup=' ?
Thanks!
This requires staging commits. Why not 'git commit -as --fixup=' ?
I'd rather explicitly stage the changes I want to add instead of making assumption that everything goes (with -a). Stage view (bound to s key) makes this easy.
The -s is not really needed given you don't really need sign-off for a fixup (commit text would get dropped anyway)
Agreed. Thanks for the tip on stage view.
On Wed, Sep 4, 2019 at 9:47 PM Adrian Salido notifications@github.com wrote:
This requires staging commits. Why not 'git commit -as --fixup=' ?
I'd rather explicitly stage the changes I want to add instead of making assumption that everything goes (with -a). Stage view (bound to s key) makes this easy.
The -s is not really needed given you don't really need sign-off for a fixup (commit text would get dropped anyway)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joelagnel/ngit/issues/1?email_source=notifications&email_token=AAAJEVATC65FIZ56LY2QDNLQIBQLRA5CNFSM4ILV7Y32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD55RMSI#issuecomment-528160329, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAJEVHKB77XQLXSSNK76RDQIBQLRANCNFSM4ILV7Y3Q .
In the spirit of Open Source software, it's usually better to collaborate on improving existing solutions then coming up with new similar ones.
From your description, that simple script looks pretty much what tig does... actually, a stripped-down version of what tig does: https://github.com/jonas/tig/
Am I missing something?