Projectile ignores all File markers except .git - emacs

I recently started working with a few projects that either don't have a .git directory in their root, or are a subdirectory of a git repo, e.g.
parent-project/
|- .git
+- my-project/
|- Cargo.toml
+- src/main.rs
And in all cases I found that Projectile sets the root to the nearest directory containing .git, ignoring all other file markers (Cargo.toml, stack.yaml, etc.) along the way. (In the example above, opening main.rs sets the project root to parent-project instead of my-project).
The Projectile documentation suggests that this should not be the case, so I'm wondering how I can either manually set the project root for each project, or configure Projectile to use the actual file markers.

Related

.gitignore not ignoring a folder within a directory

It seems a straightforward one, but having researched multiple ways to do it, I can't gitignore a folder within a directory.
I have a root directory which contains all of my code in it. Because it has some back-end NodeJS stuff in it, it has a 'node_modules' folder which contains hundreds of files. As a result, when I try to upload the entire parent folder, GitHub says there's too many files to upload and tells me to reduce the number I'm uploading.
The crucial part is though, the folder has to be uploaded as a whole, as it itself is within a GitHub repository with other files with different folders in.
That means when I go onto my repository, I need this folder's files to display within the folder, and not separately within the repository. I need all of the files to be within this folder, within the parent repository, excluding the node_modules folder.
For example ->
Parent repository -> Child Directory (what I'm uploading) -> Individual files
I've tried to add the node_modules folder to my gitignore through the following methods:
Adding: node_modules/ to my gitignore file
Writing: echo node_modules >> .gitignore through my terminal
Adding a separate gitignore file within my node_modules file with a * in it
None of them have worked and I can't find any other solutions. For reference I'm using a Mac.
Does anyone have any idea what I'm doing wrong, or how it'd be best to do it?
By default, you do not need to include the node_modules folder in your repositories because the package.json file contains all of your project's dependency information. This means that anyone who clones your repository can run npm install and have the entire node_modules folder without problems.
To solve this you can create your own .gitignore file, creating a new file at the root of your project and renaming it to .gitignore (writing exactly that way). Then you can open it with any text editor and add */node_modules to one of the lines.
This will likely solve your problem.

Ignore everything expect all subfolders / files in .gitignore

I want to allow all files (and their parent folder) within a specific directory of my eclipse project.
I want to allow all files within the libs folder
Example
RootFolder
EclipseProjects
ProjectOne
build
src
WebContent
libs
lib1
file.jar
file1.jar
lib2
file3.jar
file4.jar
etc.jar
In the root of git I have my .gitignore, which includes many variations on the same folder/files
I'm trying to just allow the jars to see if that will work too.
#Relevant lines of .gitignore
#Ignore
*.jar
#Allow
!libs/
!libs/*
!libs/*/*
!libs/**.jar
!/libs/
!/libs/*
!/libs/*/*
!/libs/**.jar
!libs/lib/*.jar
I cannot get this to work, any suggestions?
This worked for me
!**/libs/**/*

Git and Eclipse: show files outside of a project

Disclaimer: I'm new to EGit but familiar with command line Git.
In Eclipse Neon, I have a configured Git repository with this structure:
.git
README.md
.gitignore
projectA
.project
projectB
.project
projectC
.project
Problem: In Enterprise Explorer, Navigator, Project, and Package Explorer, I can only see ProjectA, ProjectB, and ProjectC, not README.md and .gitignore.
Question: How can I modify README.md and .gitignore from inside Eclipse?
Environment: Under Enterprise Explorer > Available Customizations, I have unchecked .*resources. Under Navigator > Filters I have unchecked .*
Package/Project Explorer, Navigator, etc. show only files of into Eclipse imported/opened projects. Files that are starting with . are hidden in the Package/Project Explorer, but are shown in the Navigator view by default.
In the Git Repositories view navigate to the file under the Working Tree node and double-click to open the file. Alternatively, use File > Open File....
Edit and save the file
In the Git Stagging view commit/push the file as usual
An alternative to what #howlger suggested is to create a project at the root of the repository working directory so that the readme and gitignore file become members of the workspace.
Create a General Project at the root of the working directory
Open the New Project wizard (File > New > Project) to create a General Project. Choose a project name of your choice, uncheck the Use default location checkbox, and enter the location of the repositories' working directory in the Location input field.
This will create a .project file with project metadata in the root of the working directory. If all team members use Eclipse as their IDE, it may make sense to commit this file to the repository.
(Optionally) use resource filters to exclude nested projects
Now, the Package Explorer and other navigation views show a project that contains all files and folders within the working directory, including folders that contain nested projects.
Resource filters can be used to exclude folders that contain nested projects so that only those files and folders appear that are not already shown within other projects.
To add a resource filter, open the Properties dialog of the root-level project and open the Resource > Resource Filters page. Often, all nested projects follow a common naming pattern. In this case a File and Folder Attributes filter that specifys a pattern to match the folder name can be used to exlude them. Otherwise, the Extras for Eclipse plug-ins offer a feature to exclude all Nested Wprkspace Projects.
Pros and Cons
Having all files in a repository within the IDE allows to easily edit and navigate through files including decorators that indicate the change status of all files.
Some users, however, may consider having an extra .project file at the root directory of the repository as a downside.

Do i run git init in the src folder or in the project folder of my workspace?

I couldn't find a question that similar to mine but the point I'm asking is where do I run git init? Do I run it in the src folder where my code is or in the project folder which contain the src folder and a bin folder? I'm working with eclipse and gitBash. Hope this is enough info.
What do you mean by builded project? Are you referring to .classpath, .project, .settings
When you create a repo, you need to include anything needed to actually build the project.
That include the src/ folder, but also other configuration files.
Those can include the .project (if it has only relative paths, easily reused by others), and the .classpath: see ".classpath and .project - check into version control or not?".
The settings/ folder can also be included 5see "Which eclipse files belong under Version Control", but not the .metadata/ subfolder.
It even can include settings for other IDEs like IntelliJ IDEA, if other contributors are using that tool.
It would not include the bin/ folder, typically added in a .gitignore, because its content is regenerated on demand (built).
Run it in the Project folder.
src folder contains the code files mostly. But supporting resources may be included in the other folders. And you will need to add everything to git without which project may have problem running.

Removing file from .gitignore in webstorm

I was searching the web for hour now...
I can't seem to find where the gitignore file is located,and it's ruining my life. I have to remove one file from there. I'm using WebStorm 8
Any help?
.gitignore can be in any folder inside your git repository. And the patterns in .gitignore of child folder will overwrite the ones in parent folder.
It may be hidden when you use ls in your Git Bash. Just use ls -a.
From the doc:
Patterns read from a .gitignore file in the same directory as the
path, or in any parent directory, with patterns in the higher level
files (up to the toplevel of the work tree) being overridden by those
in lower level files down to the directory containing the file. These
patterns match relative to the location of the .gitignore file.