Which files to remove from VCS in C++ project in Clion? - c++

I am new to C++, and am running CLion with github.
I have the basic hello world project set up, and there are several .xml files in a /.idea folder that I am not sure I should be including. Right now, I am including everything. My question is: what can I leave out of vcs?
Here is a snapshot of what I have (the .xmls are at the bottom; right now everything has been added to VCS, so they are all green):
The specific question is:
If I do not add the .xml files to version control, and I checkout the code from some other computer, will I be able to run the code? Or are some of the .xml files needed?
(didn't realize this was too broad. will delete if it is still too broad).

you can omit the entire .idea folder by creating a .gitignore file in the root directory and adding a line for
.idea
then you can select the .idea folder and under 'vcs' or 'git' choose 'revert' to remove them from staging if you have not committed them or to undo the commits that added them to the repo
good luck!

Related

Moving PyCharm .idea directory

I am trying to move the PyCharm .idea directory out of the project folder (a django project in this case).
I followed the instructions from JetBrains to move the .idea.properties file, which involves creating a custom .idea.properties file. I figured this might also provide a means to move the .idea folder, but having done this, it does not appear to have addressed the issue and if I create a new Django project the .idea directory is still in the Django project folder. I have looked at the contents of the custom .idea.properties file and although there is an entry relating to where it looks for .idea files to flag them as such, it doesn't appear to actually have a specific setting for the location of the .idea directory it creates for new projects.
As is often the case with JetBrains, I feel like I am missing the point somewhere and in this case searching on StackExchange or more general googling has not shed any light on the problem.
There is a workaround that I found that is in a nine-year old thread on the JetBrains 'YouTrack' bug tracking system (https://youtrack.jetbrains.com/issue/IDEA-170102?p=WI-343) but it refers to changing the Settings|Directories option in PyCharm, which I cannot locate although there are many items in the settings that refer to different directories.
Any help would be appreciated.
Instead of moving .idea directory, you can create new PyCharm project than add Content Root as original project folder.
This way you can work on the same code in different PyCharm instances
in PyCharm to change project's Content Root go to File | Settings | Project: | Project Structure.
See work in IDEA and PyCharm for the same project at the same time

Visual Studio Folders with Github

I have installed github a few days ago and just getting the hang of things, managed to figure out how to put my VSO source file into github repositories but since VSO makes an entire directory for each program full of other files along with the source file which go into the rep aswell. I'm not really sure if that's how it should be or not, But I would like for just the Source file to be sent into the repository.
Till now I've been adding with
git add .
I have tried the
git add <filename.cpp>
or
git add <filename>
but it didn't recognize it I think cuz the source file is within the directory that VSO made for it which is within my rep
Alright I think i figured it out for now,I went one directory deeper and tried the git add <filename> again and it no longer shows the other uneccesary VSO files on my rep.ty

Change Project name in WebStorm

I'm trying to change the name of my project in webstorm.
I have looked at this answer on their developer forums, but it does not work for this version (Webstorm 7). Changing the contents of .idea/.name does not change the name displayed in bold in the project folder view. I searched the .idea folder for instances of the old project name and replaced them across various configuration files like modules.xml and PROJECTNAME.iml. There are quite a few. I must have missed one because I couldn't open the project after that :)
My solution was to blow away the .idea/ folder and open the directory again, creating a new project.
Is there a better way to change a project name?
Hit cmd+R (or ctrl+R I guess) or Right click / Refactor / Rename while highlighting the top level dir in the project tree.
It shows a popup whether you want to rename the dir or the project name.
If you are struggling to rename your project in the IDE you can just rename the .iml in the .idea folder to the desired name. e.g ./idea/myProject.iml -> ./idea/myRenamedProject.iml You should close Webstorm first. I can confirm this work on OSx. I've not tried it on another operating system.
I just delete the .idea folder from File Explorer (Finder in OSX), rename the root folder of the project, and then open up the project in WebStorm. WebStorm will regenerate the .idea folder according to the new root folder name.
I've got the same problem with renaming a project in PhpStorm. There was no popup window as #bagonyi mentioned. Changing from Project Files to Project has helped. I guess it will be the same in WebStorm.

Recovering Eclipse source files from .metadata folder

I'm trying to recover some .cpp source files from Eclipse projects I made over a year ago. At the time I was using Ubuntu and I would just save all my projects to the same workspace folder.
When I went to reformat my computer a long time ago I copied my workspace folder to an external hard drive. So, recently I went to look through my old projects for a source file I need and the only thing inside my workspace folder is a hidden ".metadata" folder.
Looking though that there's a .lock file, .log file and a .plugins folder. Inside the .plugins folder is two more folders, org.eclipse.cdt.core and org.eclipse.cdt.make.core. I can see my projects inside those folders but they have .pdom and .sc extensions and I'm not sure what that is.
Can anyone give me some advice as to wether or not its possible to recover the source files (.cpp files) from the data I have? I'm now using Mac OSX but I installed Ubuntu on a VM and downloaded eclipse but had no success recovering anything. Any would be greatly appreciated!
It sounds like your source files must have been outside the workspace folder after all. In such cases, all the workspace folder would have is metadata to organize them as a project.
If the sources were inside the workspace, you wouldnt have needed to go through the .metadata folder.

How do I get Eclipse CDT to ignore files

I have a C++ project in Eclipse. The project uses Perforce and Eclipse has the Perforce plugin installed. Everything was fine, until I decided to create a git repo in my project. I created the git repo to snapshot some changes which I wasn't ready to commit. Everything was fine until I refreshed my files in Eclipse. Two problems have occurred:
Eclipse found my .git folder, and indexed all of the files inside of it.
Eclipse also decided to add all the git file to my pending change list.
If I create a new file within Eclipse, I'd like it to add it to Perforce, but if it happens to find a file, I don't want it to do anything with it. I'd also like to give Eclipse a list of file types to always ignore, just like I do with my .gitignore file.
I'm using the P4WSAD plugin, but I'm pretty sure the problem can occur anytime you have files you want Eclipse to not see.
Just add a file .p4ignore in your project root and add everything you want P4WSAD to ignore, such as
.git
See the docu on P4WSAD for more info.
That should take care of the Perforce part of your question. For the Eclipse part, please see this SO question.