Re: [PATCH] checkout: implement "-" shortcut name for last branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Fri, 16 Jan 2009, Thomas Rast wrote:

> search_reflog () {
> 	next=
> 	git reflog show HEAD |
> 	while read sha ref msg; do
> 		if test -n "$next"; then
> 			next=
> 			echo ${sha%...}
> 		fi
> 		if echo "$msg" | grep -q "^checkout: moving from $branch "; then
> 			next=t
> 		fi
> 		if echo "$msg" | grep -q "^merge $branch:"; then
> 			git rev-list --parents -1 ${sha%...} \
> 				| cut -d' ' -f3
> 		fi
> 	done
> }

How about this instead:

search_reflog () {
	sed -n 's/\([^ ]*\) .*\tcheckout: moving from $branch .*/\1/p' \
		< .git/logs/HEAD
}

Of course, this leaves out the merges...  but I'd make that a command line 
option anyway: would you like to resurrect a branch that you recently were 
on, or one that you recently merged, or one that was merged by someone 
else?

Ciao,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux