threads / discuss / 26112

Re: Basic Git Questions

Subject: Re: Basic Git Questions

## tl;dr

2 messages between Dec 20, 2010 and Dec 21, 2010.

replies: 1people: 2as markdown or json

George Spelvin· Dec 20, 2010, 19:21 UTC · lore
> 1. I generally add the files in my working directory using "git add
> .". But sometimes you want to add all the files except 1 or 2 file. Is
> there a shortcut way we can tell git to add all the files but exclude
> a particular file.

Others have pointed out the general techniques, but a few additional things that may be useful in some situations:

1) .gitignore.  If the files are such that you never want git to pay
   attention to them, you can add them to the .gitignore file.
2) "git add -u".  This adds only files that git is already tracking,
   and ignores truly new files.
3) "git add -i".  This lets you pick the files to be added from a list.
4) "git gui".  This lets you click on the files to be added.
   It's my preferred way to do a selective commit.
Adam Kellas· Dec 21, 2010, 02:59 UTC · re: George Spelvin · lore
On 12/20/2010 2:21 PM, George Spelvin wrote:
> 1) .gitignore.  If the files are such that you never want git to pay
>     attention to them, you can add them to the .gitignore file.

My own preferred pattern is to flip the default: I put a '*' in .gitignore and use "add -f" when I want files tracked.

AK

← back to recent threads