Skip to contentSkip to conversation

Don't share anything but those files

DISCUSSION Yves Perron 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Hoi,

Quoted 6 lines · Yves Perron

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.

I would use a .gitignore with something like:

cat <<EOF > .gitignore
# Ignore everything
*
# Except
!/.gitignore
!/path/to/file/1
!/path/to/file/2
EOF

Only the two specified files and the .gitignore file should be shown in git status now.

Kind regards,

Nick Douma