Re: obnoxious CLI complaints
- From
- Pierre Habouzit <madcoder@madism.org>
- Date
- Sep 9, 2009, 22:58 UTC
- Message-ID
- <20090909225820.GD29776@artemis.corp>
- In-Reply-To
- <ef38762f0909091427m5b8f3am72c88fd4dbfebc59@mail.gmail.com>
On Wed, Sep 09, 2009 at 02:27:56PM -0700, Brendan Miller wrote:
Show 8 quoted lines
> 5. Most commands require lots of flags, and don't have reasonable > defaults. e.g. archive. > > git archive --format=tar --prefix=myproject/ HEAD | gzip >myproject.tar.gz > > Should just be: > git archive > run from the root of the repo.
You can't, because "myproject" cannot be guessed most of the time.
If you really want to automatize it, it's a 2 liner shell script, or alternatively you can add that to your .gitconfig:
[alias]
archive-gz=!git archive --prefix="$(basename "$(dirname "$(readlink -m "$(git rev-parse --git-dir)")")")"/ HEAD | gzip -cIt will use the name of the directory containing your .git/ directory as a prefix, and compress it using gzip to stdout.
git archive-gz > myproject.tar.gz will do what you want.
See, that's the point about git having so many flags. You only need to look the man page _once_ (despite what you pretend): the one time you need to write your convenient wrapper around git commands that suits your exact needs.
-- ·O· Pierre Habouzit ··O madcoder@debian.org OOO http://www.madism.org