I have remote server with a git and local development machine. I need to don't send some files from my working directory on a server but stay it on version control of my local git. Let's say I have the following files on my local dev machine.
assets
|-css
|-js
compiles
-css
-js
index.html
All files are on version control, but when I need to make push I don't want it for 'assets' folder. How can I do that?
EDIT: Let me explain the situation. I'm a single developer and I do concatenate and minimize of my aseets files into compiled folder. So I don't need to push assets folder because production code uses compiles.
I have found 2 answers to this:
For a few files:git update-index --assume-unchanged FILE
For many files/directories, or more permanent for that environment, or to share file list across environments:
.git/info/exclude
./exclude
so it will grab everything.The simple answer is No, you cannot have different set of files on a given branch when you push a repo from local to remote.
Like others mentioned, you should be able to use .gitignore
to exclude the assets
directory totally from version control (on both local and remote repos):
# Your repo's .gitignore
/assets/*
You can edit .gitignore
. if you want to only works in local. You can edit .git/info/exclude
like this
.git/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
./assets/*
OR
.gitignore
./assets/*
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With