# Don't share anything but those files

8 messages from 2012-07-13 to 2012-07-16. Participants: Yves Perron, Edward Toroshchin, Taylor Hedberg, Illia Bobyr.
Thread: https://gitlist.dev/t/31017

## Yves Perron, 2012-07-13 14:59

Subject: Don't share anything but those files
Message-ID: <500037EB.5030408@modusfx.com>
URL: https://gitlist.dev/e/500037EB.5030408%40modusfx.com

```
Greetings everyone,

I'm wondering how to commit only selected files/folders on GIT, if even 
possible. Note, the ignore list is not a good option for me as I'd like 
to add a few files in a folder that contains many hundreds for instance.

Basically, I'm looking for a way to say, don't share anything but those 
files.

thx

```

## Edward Toroshchin, 2012-07-13 15:21

Subject: Re: Don't share anything but those files
Message-ID: <20120713152127.GC17521@phobos.chilli.itwm.local>
URL: https://gitlist.dev/e/20120713152127.GC17521%40phobos.chilli.itwm.local
In-Reply-To: <500037EB.5030408@modusfx.com>

```
On Fri, Jul 13, 2012 at 10:59:55AM -0400, Yves Perron wrote:
> I'm wondering how to commit only selected files/folders on GIT, if even 
> possible.

Just "git add" only the files you need.

If you want git to ignore all the rest, you can write '*' in your
.gitignore

-- 
Edward "Hades" Toroshchin
dr_lepper on irc.freenode.org

```

## Edward Toroshchin, 2012-07-13 16:14

Subject: Re: Don't share anything but those files
Message-ID: <20120713161432.GA8770@phobos>
URL: https://gitlist.dev/e/20120713161432.GA8770%40phobos
In-Reply-To: <50004048.9060203@modusfx.com>

```
On Fri, Jul 13, 2012 at 11:35:36AM -0400, Yves Perron wrote:
> Oh I see, thank you for your response,
> 
> Can I put all the folders/files I want to add in a config file so I 
> don't have to do this every time?
> 
> Thx
> 

You won't have to do this every time. Once you add a file and commit it,
git will track it in the future.

-- 
Edward "Hades" Toroshchin
dr_lepper on irc.freenode.org

```

## Yves Perron, 2012-07-13 17:40

Subject: Re: Don't share anything but those files
Message-ID: <50005DA8.5020803@modusfx.com>
URL: https://gitlist.dev/e/50005DA8.5020803%40modusfx.com
In-Reply-To: <20120713161432.GA8770@phobos>

```
Ok, let me rephrase, is there a way to edit a file where we can put 
every files/folders we need to add without the need of entering a 
command for each entry?


On 7/13/2012 12:14 PM, Edward Toroshchin wrote:
> On Fri, Jul 13, 2012 at 11:35:36AM -0400, Yves Perron wrote:
>> Oh I see, thank you for your response,
>>
>> Can I put all the folders/files I want to add in a config file so I
>> don't have to do this every time?
>>
>> Thx
>>
> You won't have to do this every time. Once you add a file and commit it,
> git will track it in the future.
>


--

```

## Taylor Hedberg, 2012-07-13 17:53

Subject: Re: Don't share anything but those files
Message-ID: <20120713175306.GB30723@euporie>
URL: https://gitlist.dev/e/20120713175306.GB30723%40euporie
In-Reply-To: <50005DA8.5020803@modusfx.com>

```
Yves Perron, Fri 2012-07-13 @ 13:40:56-0400:
> Ok, let me rephrase, is there a way to edit a file where we can put
> every files/folders we need to add without the need of entering a
> command for each entry?

Sure, but you don't need functionality built in to Git to do this. Just
list the paths you want to add in a file and then:

    xargs git add <filename

But you only have to do this once, so I'm not really sure what that buys
you.

You can use glob patterns to select groups of files to add as well, if
there is some similarity in the pathnames.

```

## Illia Bobyr, 2012-07-13 18:08

Subject: Re: Don't share anything but those files
Message-ID: <5000640F.40609@blizzard.com>
URL: https://gitlist.dev/e/5000640F.40609%40blizzard.com
In-Reply-To: <20120713152127.GC17521@phobos.chilli.itwm.local>

```
On 7/13/2012 8:21 AM, Edward Toroshchin wrote:
> On Fri, Jul 13, 2012 at 10:59:55AM -0400, Yves Perron wrote:
>> I'm wondering how to commit only selected files/folders on GIT, if even
>> possible.
> Just "git add" only the files you need.
>
> If you want git to ignore all the rest, you can write '*' in your
> .gitignore

As an alternative, you may be able to use negative patterns in your 
.gitignore or other ignore files.  Like this:

*
!.gitignore
!a_file_that_should_be_tracked
!a_dir_to_track/

See "git help ignore" for more details.

Illia Bobyr
```

## Yves Perron, 2012-07-13 18:19

Subject: Re: Don't share anything but those files
Message-ID: <500066C9.4000600@modusfx.com>
URL: https://gitlist.dev/e/500066C9.4000600%40modusfx.com
In-Reply-To: <5000640F.40609@blizzard.com>

```
On 7/13/2012 2:08 PM, Illia Bobyr wrote:
> *
> !.gitignore
> !a_file_that_should_be_tracked
> !a_dir_to_track/

That is exactly what i was hoping for,

thank you everyone!
-- 

```

## Yves Perron, 2012-07-16 14:26

Subject: Re: Don't share anything but those files
Message-ID: <500424AC.3060700@modusfx.com>
URL: https://gitlist.dev/e/500424AC.3060700%40modusfx.com
In-Reply-To: <500066C9.4000600@modusfx.com>

```
Greetings everyone,

After investigation, the solution turns out to solve the problem
partially. What is does is it update any existing files/folders already
present but does not actually add new ones. So my question is, could the
content of "what to add" be edited directly? Where is the actual
registry of added files/folders to synchronize if any?

> On 7/13/2012 2:08 PM, Illia Bobyr wrote:
>> *
>> !.gitignore
>> !a_file_that_should_be_tracked
>> !a_dir_to_track/
>
> That is exactly what i was hoping for,
>
> thank you everyone!


-- 

```
