my directory structure is like this:
roo
|
node_modules
|
packages
|
project1
|
lib
node_modules
project2
|
build
node_modules
I want to exclude lib, build or node_modules no matter where they are in the directory structure.
Here is my .gitignore
# dependencies
node_modules
/node_modules/
# testing
/coverage
# production
/build
/lib
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
.tern-port
packages/*/lib/*
packages/*/dist/*
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log
packages/*/node_modules
packages/*/lib
packages/*/build
Two options:
Use an .ignore file, and add the following to skip lib and node_moduels (for example):
*node_modules/
*lib/
Use the command line option to ignore a directory, the "--ignore-dir." For example, if you want to ignore node_modules and lib, you'd use this:
ag --ignore-dir lib --ignore-dir node_modules value
Note: I tested this with your exact directory structure.
Related
In my gitignore file i have tried some many ways of ignoring the node_modules folder
.gitignore - file
./node_modules
/node_modules
node_modules
project structure
node_modules
public
src
.gitignore
In cases where /node_modules in your .gitignore file doesn't work, I suggest this:
git rm -r --cached node_modules
enter the above command before you git push to your repositories
I have a problem with the .gitignore file in my Multiplayer Unity game project (consists of a game server and a client project in a single repository). The .gitignore file ignores most of the files, but not the binary files from the library artifacts.
Image of binary files showing in Github Desktop.
I know the .gitignore file works because if I remove it there is 30000 changed files and 8000 without removing it.
# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
[Bb]uild/
[Bb]uilds/
[Ll]ogs/
[Uu]ser[Ss]ettings/
# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/
# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta
# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*
# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*
# Visual Studio cache directory
.vs/
# Gradle cache directory
.gradle/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db
# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta
# Unity3D generated file on crash reports
sysinfo.txt
# Builds
*.apk
*.aab
*.unitypackage
# Crashlytics generated file
crashlytics-build.properties
# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*
Image of the repository folder with the 2 projects
hehe i think your answer is on the first line of the .gitignore
This .gitignore file should be placed at the root of your Unity project directory
All of those ignore paths without a preceeding / are only relative to the location of the .gitignore. It works like so:
Will ignore:
./Build/myBinary
Will not ignore:
./project1/Build/myBinary
./project2/Build/myBinary
Simplest solution is to duplicate your .gitignore and place one of each at the root of each project directory, not the repo directory.
Your directory should look like this:
myRepo
project1
.gitignore
Assets
...
project2
.gitignore
Assets
...
As mentioned, if files in these directories have already been committed they will need to be removed manually.
To be sure, assuming there are only binaries in this folders, try and delete them (from the Git index only, not from your disk), and check immediately (no commit needed) if your .gitignore applies.
cd /path/to/repo
git rm -r --cached path/to/folder/with/binaries/ # note the trailing slash
git check-ignore -v path/to/folder/with/binaries/aBinary # must be a file
If the last command does not return anything, then no .gitignore rule applies.
In my workspace, there are several directores(projects). All the directories have the same stucture, like :
project1:
docs/
src/
__init__.py
code1.py
test/
projects2:
docs/
src/
__init__.py
code2.py
test/
projects3:
docs/
src/
__init__.py
code3.py
...
# .env file in workspace
# PYTHONPATH=project1:project2:project3
When i want import package from code2, it would fail, such as code3.py
# code3.py
# from src import code2
I know in pycharm , it is easy to do with this situation by just marketing the directories as source root directory.
How can i do with it?
VS Code version: Code 1.43.2 (0ba0ca5, 2020-03-24T07:34:57.037Z)
OS version: Darwin x64 18.0.0
I have solved it by install extensions: Python/Python extension Pack/magic python
Mainly the Python Extension Pack.
When this extension enabled, others enabled, also, when it is disabled, others disabled also.
In our semester group we are using eclipse as an IDE for developing a Compiler. The issue is when it comes to git. Which files are okay to be ignored and which are crucial. It works fine on my computer, but when it is synced with git and another member from the group is trying to use the workspace, there always seem to be some errors about main not showing or a package is wrong.
Bottom line: What is okay, and what is not okay to include in .gitignore file, so that every group member is able to compile the project?
I think the best solution is to generate .gitignore for yourself by gitignore.io.
Just choose tools that you used.
It depends on your requirement.
Usually Compiled source,Packages, Logs and databases, Eclipse specific files/directories are removed from git push. Also can keep configuration in separate(property) file.It is easy to place project in a different environment.
This is a sample gitignore file
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# Logs and databases #
######################
*.log
# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
# Editor Files #
################
*~
*.swp
# Gradle Files #
################
.gradle
.m2
# Build output directies #
##########################
/target
*/target
/build
*/build
# IntelliJ specific files/directories #
#######################################
out
.idea
*.ipr
*.iws
*.iml
atlassian-ide-plugin.xml
# Eclipse specific files/directories #
######################################
.classpath
.project
.settings
.metadata
# NetBeans specific files/directories #
#######################################
.nbattrs
I've scouered the documentation for Babel and cannot seem to find an answer, so I turn to the glorious community.
With a directory structure like this:
src/
folder1/
file1.js
file2.js
folder2/
file3.js
folder3/
file4.js
file5.js
I want Babel to transpile all files into a flattened directory:
lib/
file1.js
file2.js
file3.js
file4.js
file5.js
No matter what I try, Babel always inherits the src/ directory structure. Any ideas?
If you are using babel-cli, you can do this:
babel folder1 folder2 folder3 folder4 -d lib
which works fine if you have a limited number of folders. It'll output them all flattened.
To expand on samanime's answer, if you're using babel-cli, you can simply use a wildcard on your parent folder...
babel src/** -d lib