git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: John TapsellNext: Pieter de Bie
Message 13 of 28 in “git rebase -i”
  1. John TapsellFeb 19, 2009
  2. Wincent ColaiutaFeb 19, 2009
  3. John TapsellFeb 19, 2009
  4. Wincent ColaiutaFeb 19, 2009
  5. Jeff KingFeb 19, 2009
  6. Wincent ColaiutaFeb 19, 2009
  7. Jeff KingFeb 19, 2009
  8. Theodore TsoFeb 19, 2009
  9. Teemu LikonenFeb 19, 2009
  10. John TapsellFeb 19, 2009
  11. Sitaram ChamartyFeb 19, 2009
  12. John TapsellFeb 19, 2009
  13. Stephan BeyerFeb 23, 2009
  14. Pieter de BieFeb 19, 2009
  15. Junio C HamanoFeb 19, 2009
  16. Marc BranchaudFeb 19, 2009
  17. Nazri RamliyFeb 19, 2009
  18. Thomas RastFeb 19, 2009
  19. John TapsellFeb 19, 2009
  20. Jeff KingFeb 19, 2009
  21. Jay SoffianFeb 19, 2009
  22. Johannes SchindelinFeb 19, 2009
  23. Jay SoffianFeb 19, 2009
  24. Giuseppe BilottaFeb 19, 2009
  25. Johannes SchindelinFeb 20, 2009
  26. Junio C HamanoFeb 20, 2009
  27. Jay SoffianFeb 20, 2009
  28. Michael J GruberFeb 20, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.