Re: git rebase -i

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

 



Hi,

> > 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@xxxxxxx>, PGP 0x6EDDD207FCC5040F
--
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