Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/root/rc/bin/git/rebase

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc -e

rfork en

. /rc/bin/git/defs
gitup

flagfmt='n,s src'; args='onto'
ifs=() eval `{aux/getflags $*} || exec aux/usage
nocommit=$flagn src=$flags
if(~ $#* 0) exec aux/usage

if(~ $#src 0)
	src=`{git/branch}
nflag=''
if(~ $nocomit 1)
	nflag='-n'
	
dst=`{git/query $1}
com=`{git/query $dst  $src @}
if(~ $dst $com)
	die 'nothing to rebase, doofus'
git/log -se $dst'..'$src  | awk '
BEGIN{
	src=ENVIRON["src"];
	dst=ENVIRON["dst"];
}
{
	if(!done)
		print "git/branch -nb "dst" rebase.wip";
	c=$1; $1="";
	print "git/export "c" | git/import '$nflag'#"$0;
	done=1
}
END{
	if(!done)
		print "git/branch -nb "dst" ";
	else{
		print "git/branch -nb rebase.wip "src
		print "git/branch -r rebase.wip";
	}
}' 

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.