Re: [git-users] Highlevel (but simple to implement) commands provided by default for git
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- May 29, 2013, 20:00 UTC
- Message-ID
- <CALkWK0=Sn2myT3QPCWJnoxKH4hm4s7MaB=UrPixP87MFSwKoug@mail.gmail.com>
- In-Reply-To
- <CAMP44s1VFxarV4Gp5KsxhFKJbmd033-DW8koe9P4XUZQcX4mrA@mail.gmail.com>
Felipe Contreras wrote:
Show 8 quoted lines
> On Wed, May 29, 2013 at 1:26 PM, Ramkumar Ramachandra > <artagnon@gmail.com> wrote: >> Bráulio Bhavamitra wrote: >>> root = rev-parse --show-toplevel >> >> What is your usecase for this? > > Some Git commands expect to be in the top level directory (e.g. git blame).
Um, git blame revert.c when in builtin/ works for me: what am I missing?
Show 5 quoted lines
>>> out = !git fetch `git upstream-remote` && git l `git upstream`..HEAD >> >> I didn't understand this at all. What are you doing? > > Finding out what changes haven't been pushed out yet?
... but why would I want to club a slow network operation with something like log? Yeah, I use git log @{u}.. all the time.
Show 8 quoted lines
>>> in = pull --dry-run >> >> Why? > > Because it's very easy to mess things up with 'git pull'. This > probably wouldn't be needed if we change the default of 'git pull' to > barf when the changes are not a fast-forward, and print a message > suggesting to either merge or rebase, as it has been suggested.
Yeah, I saw that thread and I think shipping "sane" defaults is a lost cause. I really want to make pull more useable, but by making it more configurable.
Show 9 quoted lines
>>> unmerged = !git ls-files --unmerged | cut -f2 | uniq >>> untracked = ls-files --other --exclude-standard >>> staged = ls-files --staged >>> modified = ls-files --modified >>> deleted = ls-files --deleted >> >> What is wrong with git status showing a unified output? > > It's not easy to be used in "scripts", say, 'gvim -p $(git unmerged)'.
RIght, but we shouldn't ship anything "pretty" for scripts, otherwise it'll become hard to understand them.
Show 5 quoted lines
>>> head = !git l -1 >> >> What is git l again? > > 'git log', of course.
I use 'git show' all the time.
Show 8 quoted lines
>>> current = rev-parse --abbrev-ref HEAD >> >> Why don't you use a prompt? Use the one in contrib/completion/git-prompt.sh. > > While this is probably a good idea, not everybody has a prompt > configured. Imagine ssh'ing to a machine you haven't touched before, > or shouldn't configure. Sure, right now you need to configure it > anyway, but the whole proposal is to make these default aliases.
Like I said earlier, I'm really not interested in sane defaults: I don't think all of us can agree on one thing.
Show 5 quoted lines
> In Mercurial 'hg branch' shows only the current branch, and I think > that's more appropriate. > > Before I configured my prompt, 'git branch' was by far the command I > used the most.
Yeah, we're fixing 'git branch' (by making it more configurable): the topic is in progress.