Skip to contentSkip to conversation

git only one file

DISCUSSION synhedionn 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

synhedionn

author
#0 lore raw

with git add . , a directory is expected, but I don't need all my files to be recorded, only one of my thousands, so how can I record just 1 file?

Signature · 2 lines
View this message in context: http://www.nabble.com/git-only-one-file-tp25140456p25140456.html
Sent from the git mailing list archive at Nabble.com.
#1 lore raw
Quoted 3 lines · synhedionn

with git add .  , a directory is expected, but I don't need all my files to be recorded, only one of my thousands, so how can I record just 1 file?

By only adding this file to the index. Use "git add $yourfile" instead of "git add ."

If you do not want to see your thousands of files in the directory when running git status, you can simply create a .gitignore file with
* as content. Git will still notify you about files which it already knows about, even though the .gitignore entry tells it to ignore everything.

Matthias

#2 lore raw
In reply to synhedionn
Quoted 4 lines · synhedionn

with git add . , a directory is expected, but I don't need all my files to be recorded, only one of my thousands, so how can I record just 1 file?

git add /path/to/file

Signature · 2 lines
View this message in context: http://www.nabble.com/git-only-one-file-tp25140456p25718014.html
Sent from the git mailing list archive at Nabble.com.