git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git-smartlist 1.0 released
@ 2020-11-30  8:46 Felipe Contreras
  0 siblings, 0 replies; only message in thread
From: Felipe Contreras @ 2020-11-30  8:46 UTC (permalink / raw)
  To: Git

Hello,

For a while I've been using some shortcuts to visualize my specific
changes in comparison to some upstream/official/master changes.

For example, if I just do "gitk @" it takes a while to load the 61K
commits that are part of the "current branch", when in fact I'm
interested in only 10 or so.

I can simply do "gitk master..@", and that does the trick, but it gets
to be a bit tedious to type that every single time.

Moreover, maybe I'm interested in two branches: "fc/feature-a", and
"fc/feature-b". I can find the specific commits with "fc/feature-a
fc/feature-b ^master".

But what if they are not based on "master", but "next". Or worse; what
if one is based on "next", and the other on "stable"?

Easy, you just do "fc/feature-a fc/feature-b --not $(git merge-base
fc/feature-a fc/feature-b)".

At this point it should be clear that perhaps a helper would help.

This is the primary problem git-smartlist is trying to solve.

In its essence git-smartlist tries to generate the revision list you
most likely want.

The whole point is to avoid typing as much as possible, and generate
minimal, yet useful, revlist.

In its main mode without any arguments git-smartlist simply generates
"@{upstream}..@". If you specify a branch, it will generate
"branch@{upstream}..branch". In both cases if no upstream branch is
configured, "master" will be used.

Then, if more than two branches are specified (e.g. fc/feature-a,
fc/feature-b), git-smartlist will find the merge base of both and do
"fc/feature-a fc/feature-b --not $merge_base".

To configure an alias for this mode:

  ls = smartlist log specific

Then, typing "git ls" will trigger this mode, and you can do "git ls",
"git ls fc/feature-a", or "git ls fc/feature-a fc/feature-b".

You can replace "log" with your favorite command. In my case it's `lg`
(log --oneline --decorate --boundary --graph).

A second very useful mode is "branches". If you specify more than one
branch it's the same as the "specific" mode, however, if you don't
specify any argument it will be the same as "--branches --not
$merge_base", and if you specify a namespace like "fc/" it will be
"--branches=fc/ --not $merge_base", or you can specify a prefix as
well "fc-*" -> "--branches=fc-* --not $merge_base".

I use this a lot when I want to see a bunch of branches with a certain
prefix, for example: "git lb fc/completion/".

If on the other hand you use gitk a lot--like me--you might want to
consider this alias:

  v = "!f() { gitk \"$@\" & }; f

Then you can have shortcuts for both text (lg) and visual (gitk)
exploration of the commits.

  ls = smartlist lg specific
  lb = smartlist lg branches
  vs = smartlist v specific
  vb = smartlist v branches

For more information check the repository in GitHub.

https://github.com/felipec/git-smartlist

Cheers.

--
Felipe Contreras

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-30  8:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30  8:46 git-smartlist 1.0 released Felipe Contreras

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).