Don't share anything but those files
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
Quoted 2 lines · Yves Perron
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
Signature · 2 lines
Edward "Hades" Toroshchin dr_lepper on irc.freenode.org
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Yves Perron
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.
Signature · 2 lines
Edward "Hades" Toroshchin dr_lepper on irc.freenode.org
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?
Quoted 11 lines · Edward Toroshchin
Quoted 7 lines · Yves Perron
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.
--
Yves Perron, Fri 2012-07-13 @ 13:40:56-0400:
Quoted 3 lines
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.
Quoted 7 lines · Edward Toroshchin
Quoted 2 lines · Yves Perron
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
Quoted 4 lines · Illia Bobyr
*
!.gitignore
!a_file_that_should_be_tracked
!a_dir_to_track/
That is exactly what i was hoping for,
thank you everyone!
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?
Quoted 9 lines · Illia Bobyr
Quoted 4 lines
*
!.gitignore
!a_file_that_should_be_tracked
!a_dir_to_track/That is exactly what i was hoping for,
thank you everyone!