* default aliases (ci, di, st, co) @ 2009-07-08 23:49 Ondrej Certik 2009-07-09 0:13 ` Jakub Narebski ` (2 more replies) 0 siblings, 3 replies; 19+ messages in thread From: Ondrej Certik @ 2009-07-08 23:49 UTC (permalink / raw) To: Git Mailing List Hi, coming to git from mercurial and svn, here is the alias part of my .gitconfig: [alias] ci = commit di = diff --color-words st = status co = checkout And all is fine until I share commands to checkout my branch (for example) with other people, then basically I have to write those commands in full (e.g. commit, checkout, ...), since I cannot assume they have their .gitconfig setup the same way I do. Especially for people who are new to git. What is the view on this in the git community? Do most of you write git checkout -b branch ... (possibly with TAB completion) or do most of you write git co -b branch ... (like I do all the time, except when sharing my commands with other people)? Could in principle those aliases be even made default by git? Or is this not a good idea. Ondrej ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-08 23:49 default aliases (ci, di, st, co) Ondrej Certik @ 2009-07-09 0:13 ` Jakub Narebski 2009-07-09 8:58 ` Graeme Geldenhuys 2009-07-09 16:43 ` Junio C Hamano 2009-07-09 7:00 ` Andreas Ericsson 2009-07-09 9:01 ` default aliases (ci, di, st, co) Graeme Geldenhuys 2 siblings, 2 replies; 19+ messages in thread From: Jakub Narebski @ 2009-07-09 0:13 UTC (permalink / raw) To: Ondrej Certik; +Cc: Git Mailing List Ondrej Certik <ondrej@certik.cz> writes: > coming to git from mercurial and svn, here is the alias part of my > .gitconfig: > > [alias] > ci = commit > di = diff --color-words > st = status > co = checkout > > > And all is fine until I share commands to checkout my branch (for > example) with other people, then basically I have to write those > commands in full (e.g. commit, checkout, ...), since I cannot assume > they have their .gitconfig setup the same way I do. Especially for > people who are new to git. If you have admin rights on the machine, you can do that either using system git config file (git config --system) i.e. $(prefix)/etc/gitconfig or rather $(sysconfdir)/gitconfig, or by providing 'config' template (copied as default repository config on init) in some place like /usr/share/git-core/templates/config . > > What is the view on this in the git community? Do most of you write > > git checkout -b branch ... > > (possibly with TAB completion) or do most of you write > > git co -b branch ... > > (like I do all the time, except when sharing my commands with other > people)? I use tab completion for commands like "git commit", "git show", "git checkout" etc. (most important part is branch completion, not command completion IMVHO). But I do have few aliases: [alias] cat = cat-file -p less = -p cat-file -p alias = config --get-regexp ^alias\\. lg = log --pretty=oneline --abbrev-commit one = show -s --pretty='format:%h (%s)' llog = log --date=local who = "!sh -c 'git log -1 --pretty=\"format:%an <%ae>\" --author=\"$1\"' -" lb = for-each-ref --format='%(refname)' \ --sort=-authordate --count=8 refs/heads/ rllog = log -g --date=relative rlg = reflog show @{now} sed = !git ls-files --stage | grep ^100 | awk '{print $4}' | xargs sed I use most often "git one" aliase (hmmm... I have just noticed that "git lg" alias is now superfluous with new '--oneline' option). > Could in principle those aliases be even made default by git? Or is > this not a good idea. The "default/built-in aliases" idea was discussed on git mailing list a few times in the past... -- Jakub Narebski Poland ShadeHawk on #git ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 0:13 ` Jakub Narebski @ 2009-07-09 8:58 ` Graeme Geldenhuys 2009-07-09 16:43 ` Junio C Hamano 1 sibling, 0 replies; 19+ messages in thread From: Graeme Geldenhuys @ 2009-07-09 8:58 UTC (permalink / raw) To: git Jakub Narebski wrote: > one = show -s --pretty='format:%h (%s)' I like that one. It's going to be very handy for when I post commit messages to my project newsgroup, as a subject title. > I use most often "git one" aliase (hmmm... I have just noticed that > "git lg" alias is now superfluous with new '--oneline' option). :-) I only learned about --oneline yesterday myself and was going to mention that to you. You beat me to it. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 0:13 ` Jakub Narebski 2009-07-09 8:58 ` Graeme Geldenhuys @ 2009-07-09 16:43 ` Junio C Hamano 2009-07-09 23:08 ` Paolo Bonzini 1 sibling, 1 reply; 19+ messages in thread From: Junio C Hamano @ 2009-07-09 16:43 UTC (permalink / raw) To: Jakub Narebski; +Cc: Ondrej Certik, Git Mailing List Jakub Narebski <jnareb@gmail.com> writes: > one = show -s --pretty='format:%h (%s)' If you use "git one" for quoting a commit in the log message, please use a format that shows the date as well (I think I posted mine to the list in the past). ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 16:43 ` Junio C Hamano @ 2009-07-09 23:08 ` Paolo Bonzini 2009-07-13 6:40 ` Jeff King 0 siblings, 1 reply; 19+ messages in thread From: Paolo Bonzini @ 2009-07-09 23:08 UTC (permalink / raw) To: Junio C Hamano; +Cc: Jakub Narebski, Ondrej Certik, Git Mailing List On 07/09/2009 06:43 PM, Junio C Hamano wrote: > Jakub Narebski<jnareb@gmail.com> writes: > >> one = show -s --pretty='format:%h (%s)' > > If you use "git one" for quoting a commit in the log message, please use a > format that shows the date as well (I think I posted mine to the list in > the past). Yes, it's in the wiki and in my .gitconfig: whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\" \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9] [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -" BTW, the wiki shows a nice trick to avoid the extra ' quotation: whatis = "!f() { git show -s --pretty='format:%h (%s, %ai' \"$@\" | sed -e 's/ [012][0-9]:[0-5][0-9]:[0-5][0-9] [-+][0-9][0-9][0-9][0-9]$/)\\n/'; }; f" Paolo ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 23:08 ` Paolo Bonzini @ 2009-07-13 6:40 ` Jeff King 2009-07-13 6:43 ` Jeff King 2009-07-13 9:15 ` Paolo Bonzini 0 siblings, 2 replies; 19+ messages in thread From: Jeff King @ 2009-07-13 6:40 UTC (permalink / raw) To: Paolo Bonzini Cc: Junio C Hamano, Jakub Narebski, Ondrej Certik, Git Mailing List On Fri, Jul 10, 2009 at 01:08:27AM +0200, Paolo Bonzini wrote: > Yes, it's in the wiki and in my .gitconfig: > > whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\" > \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9] > [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -" Is there a reason not to simply use: whatis = "show -s --pretty='format:%h (%s, %ad)' --date=short" these days? -Peff P.S. Actually, I use --no-pager in my version, so I use 'tformat' to explicitly end it with a newline, which is nicer for actually showing the output on the terminal. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-13 6:40 ` Jeff King @ 2009-07-13 6:43 ` Jeff King 2009-07-13 9:15 ` Paolo Bonzini 1 sibling, 0 replies; 19+ messages in thread From: Jeff King @ 2009-07-13 6:43 UTC (permalink / raw) To: Paolo Bonzini Cc: Junio C Hamano, Jakub Narebski, Ondrej Certik, Git Mailing List On Mon, Jul 13, 2009 at 02:40:27AM -0400, Jeff King wrote: > On Fri, Jul 10, 2009 at 01:08:27AM +0200, Paolo Bonzini wrote: > > > Yes, it's in the wiki and in my .gitconfig: > > > > whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\" > > \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9] > > [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -" > > Is there a reason not to simply use: > > whatis = "show -s --pretty='format:%h (%s, %ad)' --date=short" > > these days? > > -Peff > > P.S. Actually, I use --no-pager in my version, so I use 'tformat' to > explicitly end it with a newline, which is nicer for actually showing > the output on the terminal. Er, actually, I see yours adds the newline explicitly in the sed invocation, so it would definitely be 'tformat' to match what yours does. -Peff ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-13 6:40 ` Jeff King 2009-07-13 6:43 ` Jeff King @ 2009-07-13 9:15 ` Paolo Bonzini 1 sibling, 0 replies; 19+ messages in thread From: Paolo Bonzini @ 2009-07-13 9:15 UTC (permalink / raw) To: Jeff King; +Cc: Junio C Hamano, Jakub Narebski, Ondrej Certik, Git Mailing List On 07/13/2009 08:40 AM, Jeff King wrote: > On Fri, Jul 10, 2009 at 01:08:27AM +0200, Paolo Bonzini wrote: > >> Yes, it's in the wiki and in my .gitconfig: >> >> whatis = "!sh -c 'git show -s --pretty=\"format:%h (%s, %ai\" >> \"$@\" | sed -e \"s/ [012][0-9]:[0-5][0-9]:[0-5][0-9] >> [-+][0-9][0-9][0-9][0-9]$/)\\n/\"' -" > > Is there a reason not to simply use: > > whatis = "show -s --pretty='format:%h (%s, %ad)' --date=short" > > these days? With s/format/tformat, which I just learnt about, no, there is no reason. Thanks! Paolo ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-08 23:49 default aliases (ci, di, st, co) Ondrej Certik 2009-07-09 0:13 ` Jakub Narebski @ 2009-07-09 7:00 ` Andreas Ericsson 2009-07-09 8:50 ` Michael J Gruber ` (2 more replies) 2009-07-09 9:01 ` default aliases (ci, di, st, co) Graeme Geldenhuys 2 siblings, 3 replies; 19+ messages in thread From: Andreas Ericsson @ 2009-07-09 7:00 UTC (permalink / raw) To: Ondrej Certik; +Cc: Git Mailing List Ondrej Certik wrote: > Hi, > > coming to git from mercurial and svn, here is the alias part of my .gitconfig: > > [alias] > ci = commit > di = diff --color-words > st = status > co = checkout > > > And all is fine until I share commands to checkout my branch (for > example) with other people, then basically I have to write those > commands in full (e.g. commit, checkout, ...), since I cannot assume > they have their .gitconfig setup the same way I do. Especially for > people who are new to git. > > What is the view on this in the git community? Personally I think "plain" aliases like you use above are evil. git is not svn or mercurial. If you use it like svn you'll be surprised sooner or later and your workflow will feel awkward or just plain wrong. hg and git are very similar, but the fact that hg assumed the svn shorthands implies to me that they've tried to retain a compatibility that does not, in fact, exist. DVCS systems are enormously different from centralized ones. Borrowing from centralized ones to a DVCS one feels utterly backwards. > Do most of you write > > git checkout -b branch ... > > (possibly with TAB completion) or do most of you write > > git co -b branch ... > > (like I do all the time, except when sharing my commands with other people)? > I have no simple aliases for any of the commands. There's just no reason for them since tab completion works so well. I do have one alias, which is "wsfix". It fixes whitespace fsckups I've added to the index but not yet committed to the worktree. It's not a particularly complex one, but not exactly simple either. > Could in principle those aliases be even made default by git? Or is > this not a good idea. > I see no reason to add default aliases. It will make a mess of things when trying to explain workflows to people who have older versions of git where those default aliases aren't available. It'll add complexity to explanations, which is never a good thing. If I have a vote, I vote no. -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 Considering the successes of the wars on alcohol, poverty, drugs and terror, I think we should give some serious thought to declaring war on peace. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 7:00 ` Andreas Ericsson @ 2009-07-09 8:50 ` Michael J Gruber 2009-07-09 9:04 ` Graeme Geldenhuys 2009-07-09 9:40 ` Jakub Narebski 2009-07-09 8:58 ` Luciano Miguel Ferreira Rocha [not found] ` <20090709160249.GA12830@cthulhu> 2 siblings, 2 replies; 19+ messages in thread From: Michael J Gruber @ 2009-07-09 8:50 UTC (permalink / raw) To: Andreas Ericsson; +Cc: Ondrej Certik, Git Mailing List, Jakub Narebski Andreas Ericsson venit, vidit, dixit 09.07.2009 09:00: > Ondrej Certik wrote: >> Hi, >> >> coming to git from mercurial and svn, here is the alias part of my .gitconfig: >> >> [alias] >> ci = commit >> di = diff --color-words >> st = status >> co = checkout >> >> >> And all is fine until I share commands to checkout my branch (for >> example) with other people, then basically I have to write those >> commands in full (e.g. commit, checkout, ...), since I cannot assume >> they have their .gitconfig setup the same way I do. Especially for >> people who are new to git. >> >> What is the view on this in the git community? > > > Personally I think "plain" aliases like you use above are evil. > git is not svn or mercurial. If you use it like svn you'll be > surprised sooner or later and your workflow will feel awkward or > just plain wrong. hg and git are very similar, but the fact that > hg assumed the svn shorthands implies to me that they've tried > to retain a compatibility that does not, in fact, exist. DVCS > systems are enormously different from centralized ones. Borrowing > from centralized ones to a DVCS one feels utterly backwards. > > >> Do most of you write >> >> git checkout -b branch ... >> >> (possibly with TAB completion) or do most of you write >> >> git co -b branch ... >> >> (like I do all the time, except when sharing my commands with other people)? >> > > I have no simple aliases for any of the commands. There's just no reason > for them since tab completion works so well. > > I do have one alias, which is "wsfix". It fixes whitespace fsckups I've > added to the index but not yet committed to the worktree. It's not a > particularly complex one, but not exactly simple either. > > >> Could in principle those aliases be even made default by git? Or is >> this not a good idea. >> > > I see no reason to add default aliases. It will make a mess of things > when trying to explain workflows to people who have older versions of > git where those default aliases aren't available. It'll add complexity > to explanations, which is never a good thing. > > If I have a vote, I vote no. > Adding my no-vote to that, too. Aliases are great, but default aliases are a problem. We saw this when we introduced "git stage", and I don't think we're happy in retrorespect. Having said that, collecting useful aliases (e.g. one, who, ...) in contrib/ or in the wiki would be helpful. Michael ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 8:50 ` Michael J Gruber @ 2009-07-09 9:04 ` Graeme Geldenhuys 2009-07-09 9:40 ` Jakub Narebski 1 sibling, 0 replies; 19+ messages in thread From: Graeme Geldenhuys @ 2009-07-09 9:04 UTC (permalink / raw) To: git Michael J Gruber wrote: > > Having said that, collecting useful aliases (e.g. one, who, ...) in > contrib/ or in the wiki would be helpful. +1 to that. I only spotted the 'one' alias now. So simple yet very handy. :-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 8:50 ` Michael J Gruber 2009-07-09 9:04 ` Graeme Geldenhuys @ 2009-07-09 9:40 ` Jakub Narebski 2009-07-09 9:48 ` Michael J Gruber 1 sibling, 1 reply; 19+ messages in thread From: Jakub Narebski @ 2009-07-09 9:40 UTC (permalink / raw) To: Michael J Gruber; +Cc: Andreas Ericsson, Ondrej Certik, Git Mailing List On Thu, 9 July 2009, Michael J Gruber wrote: [...] > Aliases are great, but default aliases are a problem. We saw this when > we introduced "git stage", and I don't think we're happy in > retrorespect. > > Having said that, collecting useful aliases (e.g. one, who, ...) in > contrib/ or in the wiki would be helpful. http://git.or.cz/gitwiki/Aliases -- Jakub Narebski Poland ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 9:40 ` Jakub Narebski @ 2009-07-09 9:48 ` Michael J Gruber 0 siblings, 0 replies; 19+ messages in thread From: Michael J Gruber @ 2009-07-09 9:48 UTC (permalink / raw) To: Jakub Narebski; +Cc: Andreas Ericsson, Ondrej Certik, Git Mailing List Jakub Narebski venit, vidit, dixit 09.07.2009 11:40: > On Thu, 9 July 2009, Michael J Gruber wrote: > > [...] >> Aliases are great, but default aliases are a problem. We saw this when >> we introduced "git stage", and I don't think we're happy in >> retrorespect. >> >> Having said that, collecting useful aliases (e.g. one, who, ...) in >> contrib/ or in the wiki would be helpful. > > http://git.or.cz/gitwiki/Aliases > Thanks, I know, I added "git serve" a long time ago. I guess my use of "would" was quite misleading. Michael ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 7:00 ` Andreas Ericsson 2009-07-09 8:50 ` Michael J Gruber @ 2009-07-09 8:58 ` Luciano Miguel Ferreira Rocha 2009-07-12 5:07 ` Ondrej Certik [not found] ` <20090709160249.GA12830@cthulhu> 2 siblings, 1 reply; 19+ messages in thread From: Luciano Miguel Ferreira Rocha @ 2009-07-09 8:58 UTC (permalink / raw) To: Andreas Ericsson; +Cc: Ondrej Certik, Git Mailing List [-- Attachment #1: Type: text/plain, Size: 1469 bytes --] On Thu, Jul 09, 2009 at 09:00:30AM +0200, Andreas Ericsson wrote: > Ondrej Certik wrote: > > Hi, > > coming to git from mercurial and svn, here is the alias part of my > > .gitconfig: > > [alias] > > ci = commit > > di = diff --color-words > > st = status > > co = checkout > > And all is fine until I share commands to checkout my branch (for > > example) with other people, then basically I have to write those > > commands in full (e.g. commit, checkout, ...), since I cannot assume > > they have their .gitconfig setup the same way I do. Especially for > > people who are new to git. > > What is the view on this in the git community? > > > Personally I think "plain" aliases like you use above are evil. > git is not svn or mercurial. If you use it like svn you'll be > surprised sooner or later and your workflow will feel awkward or > just plain wrong. hg and git are very similar, but the fact that > hg assumed the svn shorthands implies to me that they've tried > to retain a compatibility that does not, in fact, exist. No, it just means that shorting common commands is useful and common. > I have no simple aliases for any of the commands. There's just no reason > for them since tab completion works so well. "Intelligent" bash completion always gets in my way, so I can't use it. I vote yes. -- Luciano Rocha <luciano@eurotux.com> Eurotux Informática, S.A. <http://www.eurotux.com/> [-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 8:58 ` Luciano Miguel Ferreira Rocha @ 2009-07-12 5:07 ` Ondrej Certik 0 siblings, 0 replies; 19+ messages in thread From: Ondrej Certik @ 2009-07-12 5:07 UTC (permalink / raw) To: Luciano Miguel Ferreira Rocha; +Cc: Andreas Ericsson, Git Mailing List On Thu, Jul 9, 2009 at 2:58 AM, Luciano Miguel Ferreira Rocha<luciano@eurotux.com> wrote: > On Thu, Jul 09, 2009 at 09:00:30AM +0200, Andreas Ericsson wrote: >> Ondrej Certik wrote: >> > Hi, >> > coming to git from mercurial and svn, here is the alias part of my >> > .gitconfig: >> > [alias] >> > ci = commit >> > di = diff --color-words >> > st = status >> > co = checkout >> > And all is fine until I share commands to checkout my branch (for >> > example) with other people, then basically I have to write those >> > commands in full (e.g. commit, checkout, ...), since I cannot assume >> > they have their .gitconfig setup the same way I do. Especially for >> > people who are new to git. >> > What is the view on this in the git community? >> >> >> Personally I think "plain" aliases like you use above are evil. >> git is not svn or mercurial. If you use it like svn you'll be >> surprised sooner or later and your workflow will feel awkward or >> just plain wrong. hg and git are very similar, but the fact that >> hg assumed the svn shorthands implies to me that they've tried >> to retain a compatibility that does not, in fact, exist. > > No, it just means that shorting common commands is useful and common. > >> I have no simple aliases for any of the commands. There's just no reason >> for them since tab completion works so well. > > "Intelligent" bash completion always gets in my way, so I can't use it. > > I vote yes. Thanks everyone for contributing to the discussion. So it seems that most people are against such aliases. I only want to correct one thing --- I use git exactly because it's not svn and exactly because it's not mercurial, things like git branches, git remote branches, rebase -i, are still truly unique, and in my experience once one tries it, he never wants to come back. That said, I do use "git ci" and "git st" very often and I don't think it infers any kind of workflow. TAB completion doesn't help, because I need to write "git stat<TAB>", e.g. I save exactly one letter., commit is better, there I just need "git com<TAB>", but I am still faster with my aliases. Maybe "git co" is nasty, but I never had any problems with that either. Ondrej ^ permalink raw reply [flat|nested] 19+ messages in thread
[parent not found: <20090709160249.GA12830@cthulhu>]
* wsfix alias [not found] ` <20090709160249.GA12830@cthulhu> @ 2009-07-09 20:54 ` Andreas Ericsson 2009-07-09 21:30 ` Larry D'Anna 0 siblings, 1 reply; 19+ messages in thread From: Andreas Ericsson @ 2009-07-09 20:54 UTC (permalink / raw) To: Larry D'Anna, John Tapsell, Git Mailing List Larry D'Anna wrote: > * Andreas Ericsson (ae@op5.se) [090709 03:04]: >> I do have one alias, which is "wsfix". It fixes whitespace fsckups I've >> added to the index but not yet committed to the worktree. It's not a >> particularly complex one, but not exactly simple either. > > oooh, i can has? > > --larry These are quite stupid and can lose data for you. Please use with some care. Oh, and I lied. I have two aliases. wsfixi is the one that applies staged stuff. wsfix fixes all whitespace errors since the last commit and stages all changes in the index. Again, use with care, and don't hang me if they break your day ;-) Mind the wrapping if your mua does things like that. [alias] wsfix = !git diff HEAD >P.diff && git reset --hard && git apply --whitespace=fix P.diff && rm -f P.diff wsfixi = !git diff --cached >P.diff && git reset && git apply --whitespace=fix P.diff && rm -f P.diff -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231 Considering the successes of the wars on alcohol, poverty, drugs and terror, I think we should give some serious thought to declaring war on peace. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: wsfix alias 2009-07-09 20:54 ` wsfix alias Andreas Ericsson @ 2009-07-09 21:30 ` Larry D'Anna 0 siblings, 0 replies; 19+ messages in thread From: Larry D'Anna @ 2009-07-09 21:30 UTC (permalink / raw) To: Andreas Ericsson; +Cc: John Tapsell, Git Mailing List * Andreas Ericsson (ae@op5.se) [090709 16:54]: > Larry D'Anna wrote: >> * Andreas Ericsson (ae@op5.se) [090709 03:04]: >>> I do have one alias, which is "wsfix". It fixes whitespace fsckups I've >>> added to the index but not yet committed to the worktree. It's not a >>> particularly complex one, but not exactly simple either. >> >> oooh, i can has? >> >> --larry > > These are quite stupid and can lose data for you. Please use with some care. > Oh, and I lied. I have two aliases. wsfixi is the one that applies staged > stuff. wsfix fixes all whitespace errors since the last commit and stages > all changes in the index. Again, use with care, and don't hang me if they > break your day ;-) > > Mind the wrapping if your mua does things like that. > > [alias] > wsfix = !git diff HEAD >P.diff && git reset --hard && git apply --whitespace=fix P.diff && rm -f P.diff > wsfixi = !git diff --cached >P.diff && git reset && git apply --whitespace=fix P.diff && rm -f P.diff a safer one: xargs -0 -I: <<'EOF' git config --file ~/.gitconfig alias.wsfix : ! . "$(git --exec-path)"/git-sh-setup if git-diff --quiet --exit-code; then if git diff --cached --check >/dev/null; then exit 0; fi echo fixing git diff --cached > $GIT_DIR/wsfix.diff git apply -R $GIT_DIR/wsfix.diff git apply --whitespace=fix $GIT_DIR/wsfix.diff rm -f $GIT_DIR/wsfix.diff else echo wokring tree is dirty\! fi EOF --larry ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-08 23:49 default aliases (ci, di, st, co) Ondrej Certik 2009-07-09 0:13 ` Jakub Narebski 2009-07-09 7:00 ` Andreas Ericsson @ 2009-07-09 9:01 ` Graeme Geldenhuys 2009-07-09 9:12 ` Matthieu Moy 2 siblings, 1 reply; 19+ messages in thread From: Graeme Geldenhuys @ 2009-07-09 9:01 UTC (permalink / raw) To: git Ondrej Certik wrote: > [alias] > ci = commit > di = diff --color-words > st = status > co = checkout > I also gave from SVN and I must admit, I did create co, st, ci aliases, but basically never used them, so removed them since. Git is not SVN, so why treat it as such. Alternatively, you can put your alias somewhere on a wiki or personal web page and just refer user to look at your alias list, instead of having to explain to them every time why your git commands are non-standard. It might save you some time and effort - in the long run. Or just learn the full git commands. ;-) Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: default aliases (ci, di, st, co) 2009-07-09 9:01 ` default aliases (ci, di, st, co) Graeme Geldenhuys @ 2009-07-09 9:12 ` Matthieu Moy 0 siblings, 0 replies; 19+ messages in thread From: Matthieu Moy @ 2009-07-09 9:12 UTC (permalink / raw) To: Graeme Geldenhuys; +Cc: git Graeme Geldenhuys <graemeg@gmail.com> writes: > Ondrej Certik wrote: >> [alias] >> ci = commit >> di = diff --color-words >> st = status >> co = checkout >> > > I also gave from SVN and I must admit, I did create co, st, ci > aliases, but basically never used them, so removed them since. Git is > not SVN, so why treat it as such. co is indeed particularly nasty. Yes, it's common for cvs/svn old-timers, but "co" is a prefix of "COmmit", and means "CheckOut". That's really misleading. And the problem with aliases is that although they are good for personnal use, they become bad when people use them publicly : either in mail messages or in scripts. Ask about something that requires "git commit" on the Git mailing list, everybody will be talking about "git commit", not one about "git ci", the other about "git checkin" and the last one about "git commit". That's far less misleading (yes, the example is oversimplified, but if I advise someone to use "git diff --color-words", he/she understands what I'm talking about immediately, while if I advise "git di", it requires more time). One thing I'd like to see is a wizard that creates a ~/.gitconfig with this section commented out when it does not exist, like [alias] # Aliases, uncomment the lines to use them. # ci = commit # di = diff --color-words To reduce the effort of people willing to use aliases, without making them totally official. -- Matthieu ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2009-07-13 9:15 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-08 23:49 default aliases (ci, di, st, co) Ondrej Certik 2009-07-09 0:13 ` Jakub Narebski 2009-07-09 8:58 ` Graeme Geldenhuys 2009-07-09 16:43 ` Junio C Hamano 2009-07-09 23:08 ` Paolo Bonzini 2009-07-13 6:40 ` Jeff King 2009-07-13 6:43 ` Jeff King 2009-07-13 9:15 ` Paolo Bonzini 2009-07-09 7:00 ` Andreas Ericsson 2009-07-09 8:50 ` Michael J Gruber 2009-07-09 9:04 ` Graeme Geldenhuys 2009-07-09 9:40 ` Jakub Narebski 2009-07-09 9:48 ` Michael J Gruber 2009-07-09 8:58 ` Luciano Miguel Ferreira Rocha 2009-07-12 5:07 ` Ondrej Certik [not found] ` <20090709160249.GA12830@cthulhu> 2009-07-09 20:54 ` wsfix alias Andreas Ericsson 2009-07-09 21:30 ` Larry D'Anna 2009-07-09 9:01 ` default aliases (ci, di, st, co) Graeme Geldenhuys 2009-07-09 9:12 ` Matthieu Moy
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).