How to send all directory files except a specific one?

1

I would like to send all files in the directory except config.php . Basically I use the git add . command to add all the files, but when I have few edited files, I do this:

git add arquivo1.php
git add arquivo2.php
git add arquivo3.php

The config.php file on my machine is one way, but on the server it has other specific variables. I do not always need to send config.php . I would like a command to send all files except this one. I know there is .gitignore and also this question about Ignore All files except a specific one in GIT , but sometimes I need to send the file config.php , without ignoring it, when there is a specific configuration.

In the "pseudocommand" would be something like:

git add . exceto config.php

How to send all directory files except a specific one?

    
asked by anonymous 16.06.2017 / 19:44

3 answers

1

Ignore Changes / Changes in GIT

If you want to ignore modifications to a specific "git server" file, what you can try is to force the assumption that there were no changes (I believe it's only necessary once):

git update-index --assume-unchanged foo/bar/baz/config.php

So the file that already exists in the repository will not be removed, but will no longer be updated, but if you make any changes that require you to update config.php then use:

git update-index --no-assume-unchanged foo/bar/baz/config.php

And then in the next update use --assume-unchanged no config.php

Ignore send (remove file)

If you want to ignore that a file is being sent, you can use the .gitignore and adjust it if you want to send later, .gitignore is an editable file at any time and you use it as you wish.

If you add:

 config.php

In addition to not sending, if there is any config.php in the repository it will be removed from there.

    
16.06.2017 / 20:24
0

Add only what you have changed:

git add -u

Summary

git add -A   Tudo que estiver em staging
git add .    Tudo em stage, e modificados 
git add -u   stage modificados e deletados, novos ignorados.
    
16.06.2017 / 19:56
0

Make the normal addition and request a rollback of config.php .

git add -u
git reset -- config.php
    
16.06.2017 / 20:11