Jan Engelhardt [off-list ref] writes:
On Monday 2012-07-30 14:11, Thomas Badie wrote:
quoted
Hi all,
When I should fixup or squash a commit, I nearly never
remember how to get the sha1 of the commit I want to fixup.
Because sometimes HEAD~n is not enough, I make `git log`,
copy the sha1 of the right commit and paste it in my git
fixup command. So I wrote a perl script to avoid the usage
of the mouse.
If you use screen(1), you can use the keyboard as well; it offers ^A [
and ^A ] for copy, and then paste. tmux and all those screen clones
probably have something similar. Maybe ratpoison-like WMs do as well.
Or, you can use `git log --oneline`, look for the commit and then
type the (usually) 6-char part of the hash manually, which may be faster
than ^A[, moving the cursor to the copy position, marking it, etc.
Also,
git show -s ':/^t1100-.*: Fix an interm'
would work well. It your log messages are not descriptive enough,
however, that may not, but that is easily fixable by training you
and your colleages to give a more descriptive title to each commit,
which will make your project better.
2012/7/30 Junio C Hamano [off-list ref]:
Jan Engelhardt [off-list ref] writes:
quoted
On Monday 2012-07-30 14:11, Thomas Badie wrote:
quoted
Hi all,
When I should fixup or squash a commit, I nearly never
remember how to get the sha1 of the commit I want to fixup.
Because sometimes HEAD~n is not enough, I make `git log`,
copy the sha1 of the right commit and paste it in my git
fixup command. So I wrote a perl script to avoid the usage
of the mouse.
If you use screen(1), you can use the keyboard as well; it offers ^A [
and ^A ] for copy, and then paste. tmux and all those screen clones
probably have something similar. Maybe ratpoison-like WMs do as well.
Or, you can use `git log --oneline`, look for the commit and then
type the (usually) 6-char part of the hash manually, which may be faster
than ^A[, moving the cursor to the copy position, marking it, etc.
Also,
git show -s ':/^t1100-.*: Fix an interm'
would work well. It your log messages are not descriptive enough,
however, that may not, but that is easily fixable by training you
and your colleages to give a more descriptive title to each commit,
which will make your project better.
Another aim of this module would be to avoid writing the beginning of
the commit message.
Thanks for your proposition. I didn't know this solution.
--
Thomas "Enki" Badie
On Mon, Jul 30, 2012 at 11:45 AM, Junio C Hamano [off-list ref] wrote:
git show -s ':/^t1100-.*: Fix an interm'
That doesn't work for me (git 1.7.10.4 as per Fedora 18 rpms) in
git.git. But the idea is sound -- git can give you the sha1 trivially.
You don't need additional glue.
But any ref definition can be turned into a sha1 with this snippet:
git show --pretty=format:%H HEAD
If you want to get the last 10 sha1s, use the same "pretty" with git log
git log --pretty=format:%H HEAD | head
This is all predicated on passing the info to something else. For git
commands, you can always use the rich ref notation git supports.
cheers,
m
--
martin.langhoff@gmail.com
martin@laptop.org -- Software Architect - OLPC
- ask interesting questions
- don't get distracted with shiny stuff - working code first
- http://wiki.laptop.org/go/User:Martinlanghoff