0ana
0ana

Reputation: 159

How to copy a file in a git tree?

I've just started learning git and I can't really find the answer to this.

What does it mean copying a (.config) file into the git tree?

Do I have to copy it, into the .git directory or something else?

Later edit: I am supposed to duplicate my distro, so I have to copy one of the config-* files visible with ls /boot in a .config file in my git tree.

On Linux Kernel Newbies I found:

Duplicating your current config

If you're trying to see if a bug is fixed, you probably want to duplicate the configuration on your running kernel. That config file is stored somewhere in /boot/. There might be several files that start with config, so you want the one associated with your running kernel. You can find that by running uname -a and finding the config file that ends with your kernel version number. Copy that file into the source directory as .config. Or just run this command:

cp /boot/config-uname -r* .config

Will this work if I changed the directory to be /git or does this not make sense at all?

Upvotes: 0

Views: 130

Answers (1)

Tiki-Web
Tiki-Web

Reputation: 106

Do you mean the Git config file or something else ? You should never write directly into the .git directory. Instead you interact with it using Git commands. In general, adding a file to the tree means : - committing the file - pushing it to the right branch.

git add relative-path/file
git commit -m 'some comment'
git push yourbranch

If you need to add Git configuration, you just have to call

git config <some option>

Did it help you ?

Best regards

Upvotes: 1

Related Questions