Re: git rebase -i
- From
Stephan Beyer <s-beyer@gmx.net>
- Date
- Feb 23, 2009, 00:32 UTC
- Message-ID
- <20090223003245.GC21616@leksak.fem-net>
- In-Reply-To
- <43d8ce650902190152t6162593x8d0920be0e6d7a6d@mail.gmail.com>
Hi,
Show 11 quoted lines
> > I think it's better to use aliases for this kind of personal things: > > > > git config --global alias.my-rebase "rebase -i HEAD~10" > > > > Now you can do: > > > > git my-rebase > > > > I'm trying to make git more obvious and easier to use, rather than > find any solution :-)
As Wincent pointed out, git rebase -i without arguments isn't that obvious or intuitive.
If you was looking for a solution, I'd be telling you that I use a simple script "git-tickle-last" for this purpose:
--- 8< --- #!/bin/sh default=10
get_safe_num () {
n=0
git rev-list --parents "HEAD~$default.." | while read line
do
i=0
for p in $line
do
i=$((i+1))
done
if test "$i" -gt 2
then
echo $n
return 1
fi
n=$((n+1))
done && echo $default
}git rebase -i "HEAD~$(get_safe_num)" --- >8---
It makes sure (I hope) that no merges get into the list, but it doesn't care about published changes (i.e. tracking branch behavior).
I use it because I often reorder or squash commits before I push or merge.
Regards, Stephan
-- Stephan Beyer <s-beyer@gmx.net>, PGP 0x6EDDD207FCC5040F