A folder is mysteriously added into my .gitignore file - eclipse

I have an Eclipse project which contains only a single folder "MyFolder" containing a LaTeX file "myfile.tex". For some reason, whenever I refresh the project or save a file, the following line is added to the .gitignore file at the root of my project:
/MyFolder
I.e., someone mysteriously tells GIT to ignore the entire folder which contains my tex file. I suspect it's the tex plugin doing this. But why? How can I prevent this?

Try to:
Team → Git → Projects and unmark:
"Automatically ignore derived resources by adding them to .gitignore".

Related

.gitignore file not ignoring .env.local or any other supposed private file

I encountered this error because I once mistakenly committed .env.local before adding it to .gitignore. The answer to it below.
If you're facing something similar and you use the Git GUI in VSCode, just follow these steps:
Open your .env.local file or any file that's having this issue, copy the content to clipboard, and delete the file entirely.
Open your .gitignore file and delete the line that removes that file.
Commit your changes (not necessarily publish).
Now create a new .env.local file (or the file you deleted earlier in your case.)
Switch to your Source Control tab (where you see staged files), right click on this newly created file and add it to .gitignore
Now, it will be ignored for real.

.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.

Eclipse Oxygen - Git Staging NOT Showing File Under Dot Folder

I have a project in Eclipse Oxygen that uses Git. When a file is created or edited it shows in the Unstaged Changes list on the Git Staging View. This allows you to drag the file to the Staged Changes list and then it can be committed.
I needed to create a folder named .sti directly under the project folder and then a folder named bin under that, like this:
project/.sti/bin
Then I had to create a file called assemble in the .stl/bin folder.
The problem is that the file called assemble does NOT show in the Unstaged Changes list. Therefore I cannot stage and commit it.
Is there any way of getting this file to appear?
I'm sure that the .sti folder is the cause of the problem.
Any ideas or help would be much appreciated...
In the end I deleted the .gitignore file in the project folder and recreated it. Upon refreshing the project in Project Explorer, the changed file appeared in the Unstaged Changes.
This was rather strange as the original .gitignore did not specify: .sti

how to rollback the ignore state of a file/folder in git using eclipse

accidently I set the ignore state for a folder in GIT in eclipse.
context-menu on the folder -> team -> ignore.
How can I activate this folder for GIT again ?
I guess it must be team -> add to index, but this doesn't work for me.
any help ?
Click Ctrl+shift+R and type .gitignore in eclipse.
Open the .gitignore file of respective project.
All the ignored file's path will be displayed here.
Now remove the paths of files which you want to unignore and save it.
Again the files will be back to its original stage and can be added to staging area.
Steps to make file unAssumed ignore
If you don't want your files to be ignored then do the following
Go to the file you don't want to be ignored and rightclick it --> Team --> Advanced --> No Assume Unchanged
Please find the same in image
See this bug right now there is no way to find all ignored resource in a git repo using EGIT.
When you do Team context-menu on the folder -> team -> ignore it will automatically create a .gitignore file inside the parent folder and this file is added automatically to git index and will be shown in git staging view.
After committing this file it is difficult to find all ignored resources in a given git repo. Go to your file explorer and search for all .gitignore files inside a git repo and view their content.
In the base directory of the git project, there will be a file called .gitignore (Note the dot at the start of the filename).
This file lists all the files, directories etc that are ignored by git.
Simply edit that file, removing the line which corresponds to the folder you accidentally added.

How to ignore files via GUI in Gitkraken?

I come from SourceTree to board the GitKraken hype train. It has always been pretty easy to ignore files within ST. Just right-click on a file in the unstaged container and you've all the options. You can ignore the files directly, each file beneath a specific folder etc. (so, all the .gitignore stuff from within the GUI =)).
However, I can't find a similar feature in GitKraken. Does anybody know how I can ignore files via the GUI of GitKraken?
Please note: This is not a git question. I absolutely know in depth how ignoring files in Git work. But that's not the topic whatsoever. This is just a trivial GitKraken support question.
Currently there isn't an option to ignore a file through the GitKraken GUI.
If you check their post on twitter this is planned to be implemented soon and it will be in their release notes once this is completed.
UPDATE (26.01.2017.):
Version 2.0.0 brings the .gitignore option to the list of functionalities. You can now select a file or folder in the file staging area, and add to the .gitignore file on the fly. Right-click and select Ignore. From there, you can:
Add that specific file to .gitignore
Add all files with that file extension to .gitignore
Add all files in the same folder as the selected file to
.gitignore
(If selecting a folder) add that folder to the .gitignore