LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-02-2010, 11:31 AM   #1
potuz
Member
 
Registered: Jul 2009
Distribution: Gentoo, CLFS.
Posts: 40

Rep: Reputation: 16
setting git-diff --color-words as git-diff


Hi there, I like the output of
Code:
 git diff --color-words old..new
but I do not know how to set --color-words permanently in the ~/.gitconfig file. Any help would be appreciated.

R.

Edit: I guess I should've said that I do not want an alias for diff --color-words

Last edited by potuz; 06-02-2010 at 11:37 AM.
 
Old 06-02-2010, 12:49 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It sounds like you need to use what is known generically as an 'alias'. If you are using bash (or other Korn shell derivative):
Code:
alias git="git diff --color-words"
I'm not familiar with the git command specifically, but I think you should be able to decipher the process. If you want to make this active for all subsequent logins, simply put the command in your ~/.bashrc file.
--- rod.
 
Old 06-02-2010, 05:08 PM   #3
potuz
Member
 
Registered: Jul 2009
Distribution: Gentoo, CLFS.
Posts: 40

Original Poster
Rep: Reputation: 16
Luckily my "Edit" was an hour before your post

R.
 
Old 06-02-2010, 06:30 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Okay, so now I'm confused about what you do want. Can you spell out the command you presently use, followed separately by the command that you think would be preferable?

--- rod.
 
Old 06-02-2010, 11:19 PM   #5
potuz
Member
 
Registered: Jul 2009
Distribution: Gentoo, CLFS.
Posts: 40

Original Poster
Rep: Reputation: 16
Well, I presently use an alias of the form
Code:
 git wdiff old..new
where I have an alias as
Code:
 [alias]
	wdiff = diff --color-words
Therefore my command is equivalent indeed to
Code:
 git diff --color-words old..new
However, I would like to not use an alias (for example because I'd have to change some scripts) and just use
Code:
 git diff old..new
and I was hoping that there could be a global variable that I can set on ~/.gitconfig that would add automatically the --color-words clause. Just as is the case if you want to add the --color clause by having color.diff=auto.

I'm sorry for not spelling everything in the original post.

Cheers,

R.

Edit. Just in case someone reads this thread at some point later. If you want to have an alias for a git command, it is much better to put it in your ~/.gitconfig file under the [alias] clause as I posted here instead of a strange alias in bashrc. On the one hand cause it doesn't need to be in memory all time. On the other cause that way you can still use git as the first command. Note that the suggestion in post #2 would've been quite strange when you try "git pull" for example

Last edited by potuz; 06-02-2010 at 11:25 PM.
 
Old 09-09-2010, 01:31 PM   #6
jtriley
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
just found this:

Code:
$ git config --global color.diff auto
or to force always using color:

Code:
$ git config --global color.diff always
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SBo-git - slackbuilds.org on git (with patches for current) ponce Slackware 47 03-12-2011 05:12 AM
Script to isolate files with 1 instance of each of 4 diff. words (grep) kmkocot Linux - Newbie 3 08-24-2009 08:54 AM
why is git scm named 'git'? hottdogg Linux - General 5 02-03-2009 07:25 AM
inconsistency issue of git-clone ***/git/mesa/drm with the existing kernel source centguy Linux - Desktop 2 10-08-2008 10:36 PM
Dual Boot diff Hard Disk diff OS on Suse 9.1 wilhem Linux - Newbie 1 08-13-2004 06:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration