Re: [git-users] gitignore change for tracked / untracked files

2014-01-31 Thread Thomas Ferris Nicolaisen
On Friday, January 31, 2014 7:36:52 AM UTC+1, Philipp Kraus wrote:

 Hello,
 sorry for the late answer.

 Am Mittwoch, 22. Januar 2014 21:27:18 UTC+1 schrieb Magnus Therning:

 I'm not 100% sure I understand what you wish to do, but you might want 
 to look at `git clean`.  By default it just lists the files it would 
 delete, you have to pass it '-f' to actually remove stuff.  You can 
 also control whether you want it to deal with ignored files or not. 


 I'm using gitignore like a black list, so my git ignore defines all files 
 which are not allowed.
 If I switch this to a white list, I need a check if everything is all 
 right. git clean works only
 with untracked files, but in my case I have got tracked files, which can 
 be after the gitignore
 changing also ignored. 
 Did you have got an idea, in which way I can change my gitignores, so that 
 I do not forget some files?


So, you want to change .gitignore
and then see which already checked-in files would have been ignored had 
they not been added already..

Well.. Here's a pragmatic approach:

cd repo
mv .git .. # move .git somewhere else temporarily
git init
git status --ignored # behold, all ignored files!
rm -r .git
mv ../.git . #revert to old state

If you don't want to toss your .git dir around, you can achieve the same by 
using the GIT_DIR variable:

cd repo
git --git-dir /tmp/foo.git init #just init an empty repo somewhere
git --git-dir /tmp/foo.git --work-tree . status --ignored  

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] gitignore change for tracked / untracked files

2014-01-30 Thread Philipp Kraus
Hello,
sorry for the late answer.

Am Mittwoch, 22. Januar 2014 21:27:18 UTC+1 schrieb Magnus Therning:

 I'm not 100% sure I understand what you wish to do, but you might want 
 to look at `git clean`.  By default it just lists the files it would 
 delete, you have to pass it '-f' to actually remove stuff.  You can 
 also control whether you want it to deal with ignored files or not. 


I'm using gitignore like a black list, so my git ignore defines all files 
which are not allowed.
If I switch this to a white list, I need a check if everything is all 
right. git clean works only
with untracked files, but in my case I have got tracked files, which can be 
after the gitignore
changing also ignored. 
Did you have got an idea, in which way I can change my gitignores, so that 
I do not forget some files?

Phil

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [git-users] gitignore change for tracked / untracked files

2014-01-22 Thread Magnus Therning
On Wed, Jan 22, 2014 at 11:50:16AM -0800, Philipp Kraus wrote:
 Hello,
 
 I have defined a gitignore with file pattern, which should be ignored eg:
 *.tmp
 *.bak
 ...
 
 I would change the gitignore file to:
 .*
 !*.cpp
 !*.res
 
 but I would also removed tracked files, which are added to the repo if the 
 files does not match the ignore pattern.
 I would like to check the current files after changing the gitignore which 
 will not be matched and after that I will
 remove them from the repo
 
 How can I do this

I'm not 100% sure I understand what you wish to do, but you might want
to look at `git clean`.  By default it just lists the files it would
delete, you have to pass it '-f' to actually remove stuff.  You can
also control whether you want it to deal with ignored files or not.

/M

-- 
Magnus Therning  OpenPGP: 0xAB4DFBA4 
email: mag...@therning.org   jabber: mag...@therning.org
twitter: magthe   http://therning.org/magnus

Most software today is very much like an Egyptian pyramid with
millions of bricks piled on top of each other, with no structural
integrity, but just done by brute force and thousands of slaves.
 -- Alan Kay


signature.asc
Description: Digital signature