git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Announce: git-number
@ 2011-03-24  4:51 Nazri Ramliy
  2011-03-24  5:46 ` Nguyen Thai Ngoc Duy
  0 siblings, 1 reply; 2+ messages in thread
From: Nazri Ramliy @ 2011-03-24  4:51 UTC (permalink / raw)
  To: git

Hi,

I'd like to announce a little tool that I have been using for the past
few years whenever I use git: git-number.

git-number allows you to use numbers in place of filenames whenever
you need to provide them to any git command.

When run without argument it will run git-status and prepend a number
for each file name that git-status shows, starting from 1:

	$ git number
	# On branch master
	# Untracked files:
	#   (use "git add <file>..." to include in what will be committed)
	#
	#1      foo/bar/baz/frobnit.fu
	nothing added to commit but untracked files present (use "git add" to track)

The output is exactly the same as git status (with color), but with
numbers associated with each file that is shown.

Now, instead of writing:

	$ git add foo/bar/baz/frobnit.fu

You can just do

	$ git number add 1

Still that's bit too long for my taste so I have this alias:

	$ alias gn='git number'

So that now I can do

	$ gn add 1

or

	$ gn reset 15

Even that is a bit too long for my taste, so I have this alias too:

	$ alias ga='git number add'

So that I can do this instead:

	$ ga 1

Which is equivalent to writing

	$ git add foo/bar/baz/frobnit.fu

It also know ranges:

	$ ga 5-9 11


Like it? Get it here: https://github.com/holygeek/git-number

Caveats:
- It depends on the ouput of git-status, which is porcelain. Caveat emptor.
- I does not work for renames (#42	renamed:    a.txt -> b.txt)

Thanks.

nazri

P.S. I tried adding it to git wiki but had problem verifying my email, the page
said "Invalid confirmation code. The code may have expired.", even on my
second attempt at reconfirming my email.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Announce: git-number
  2011-03-24  4:51 Announce: git-number Nazri Ramliy
@ 2011-03-24  5:46 ` Nguyen Thai Ngoc Duy
  0 siblings, 0 replies; 2+ messages in thread
From: Nguyen Thai Ngoc Duy @ 2011-03-24  5:46 UTC (permalink / raw)
  To: Nazri Ramliy; +Cc: git

On Thu, Mar 24, 2011 at 11:51 AM, Nazri Ramliy <ayiehere@gmail.com> wrote:
> Hi,
>
> I'd like to announce a little tool that I have been using for the past
> few years whenever I use git: git-number.
>
> git-number allows you to use numbers in place of filenames whenever
> you need to provide them to any git command.
>
> When run without argument it will run git-status and prepend a number
> for each file name that git-status shows, starting from 1:
>
>        $ git number
>        # On branch master
>        # Untracked files:
>        #   (use "git add <file>..." to include in what will be committed)
>        #
>        #1      foo/bar/baz/frobnit.fu
>        nothing added to commit but untracked files present (use "git add" to track)
>
> The output is exactly the same as git status (with color), but with
> numbers associated with each file that is shown.
>
> Now, instead of writing:
>
>        $ git add foo/bar/baz/frobnit.fu
>
> You can just do
>
>        $ git number add 1
>

Nice. I have something similar in a private tool (same problem: too
long paths to type). This can be made applicable to a few other
commands too, like 'diff --stat'. I think the magic character [1], be
it ':' or '/', can be used to make this (the syntax is for
demostration only):

$ git add :@{1}

equivalent to your 'git number add 1'.

[1] http://article.gmane.org/gmane.comp.version-control.git/169844
-- 
Duy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-24  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-24  4:51 Announce: git-number Nazri Ramliy
2011-03-24  5:46 ` Nguyen Thai Ngoc Duy

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 NNTP newsgroup(s).