What exactly is .idea/workspace.xml? - ruby-on-rails

I had not heard of this file until I randomly checked git status in an old repository and there it was, a file I had not edited myself nor ever seen before. I do not know how it got there.
It seems it's common asked about - mostly how to remove it (e.g. here and here).
What is this file, and what created it?

.idea is the dir for saving the project configurations for all Jetbrains IDES (RubyMine , Pycharm , PHPStorm , WebStorm ..etc)
you can handle it using two ways if you don't want to commit it to the repo
Ignore it only for yourself
in .git/info/exclude
add /.idea
Ignore it in .gitignore so it will be ignored for everyone who uses the repo
by adding /.idea to .gitignore
if the dir .idea already tracked by git you will need to remove it first from the cached files before ignoring by git rm -r --cached .idea
This folder can include important configuration if you did any custom configuration for the project and also include the indexed data for the IDE which helps it to provide quick autocomplete and in certain cases would be better to commit it to the repo but I always ignore it because the other developers in the team don't use RubyMinee

Related

Do these files need to be pushed to Github?

I made a Rails application.
Do i need to push these files to Github?
.browserslistrc
.gitattributes
.rspec
.ruby-version
The short answers are "if you want", and "there's no reason not to".
All of these files do something to make it easier to replicate your code base and setup on another machine. None of them contain secrets that shouldn't be shared.
.browserslistrc
The config to share target browsers and Node.js versions between different front-end tools.
.gitattributes
a simple text file that gives attributes to pathnames.
These attributes affect how the contents stored in the repository are copied to the working tree files when commands such as git switch, git checkout and git merge run. They also affect how Git stores the contents you prepare in the working tree in the repository upon git add and git commit.
.rspec
Read command line configuration options from files
.ruby-version
Many Ruby (or Rails) projects will include a simple .ruby-version file, which simply specifies a version number

I have tons of "Untracked Files" in git in Xcode project

I am using git with Xcode but when i commit files using Xcode (not command line) after committing and pushing to remote, when i use git status this is the result.
What are Untracked Files. What should i do with them?
And what about Changes not staged for commit part? What are they?
These untracked files are files that have been added to your directory structure (e.g. it would appear that you did a pod install), but you have neither added them to source control nor told git to ignore them. (I would tell git to ignore them, personally.)
But you have to decide whether you want to add the Pods directory to your repo or whether you'd like to ignore them. See https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control. (I personally don't put Pods into source control, just the Podfile and Podfile.lock. There are many opinions on that topic, though.)
Re the .DS_Store, we often have a ~/.gitignore_global that tells it to ignore those, too. Once you tell it to ignore these, they will be removed from the “untracked” files list. See .gitignore all the .DS_Store files in every folder and subfolder.
Re the unstaged .DS_Store it looks like your repo already had that one .DS_Store in the repo. I would suggest removing it from the repo. See How can I Remove .DS_Store files from a Git repository?.
In short, it looks like you have a project with no .gitignore file (or it is missing entries). It also looks like you don’t have a ~/.gitignore_global to ignore .DS_Store files.
For an example of a .gitignore that you might use for Swift projects, see https://github.com/github/gitignore/blob/master/Swift.gitignore (though, like I said, I generally would uncomment the Pods from that particular .gitignore).

What files should Xcode projects track when git commits

I took over an iOS project completed by objective-c. The project does not use git, and I want to use git to manage it locally.
I performed the following steps, and then when I submitted, I didn't know which files to add to the tracking file. (I created git to ignore files)
Steps i did
I opened the terminal and entered the following command:
cd /Users/xxx/Desktop/xxx/Myproject
git init
touch .gitignore
open .gitignore //I manually added the ignore rule in .gitignore and saved
git status //我没有修改任何代码,而且没有执行 git add ,因为我不知道该添加哪些文件到追踪文件
This is ignore file
Should I execute git add .? Or should I choose some additions?
I hope you can tell me the method and reason, I do n’t understand what I found on Google.

Force git to ignore a directory and all present and future files within

So, I'm a newbie at git, but I'm using it because I have my rails app deployed through heroku. My app generates a bookmarklet (which is just a js file) for each user upon sign-up. Unfortunately, when I deploy, all of the bookmarklets for the users on the live site get overwritten with the bookmarklets for the users on my dev environment. I've read some other questions about this kind of thing, and I know I'll have to add the bookmarklet folder to the .gitignore file, and something about rm --cache (but I'm not sure exactly what I'll have to do). I tried doing these things, but I'm wondering if the problem is that git is ignoring all of the files that are there now, but isn't ignoring the ones that are generated after doing the whole gitignore process. Either that or I'm just doing it wrong (this is very, very likely).
Any help is welcome. And sorry that this covers the same ground as a lot of other similar questions. I did as much research as I could.
Thanks.
Here some simple steps:
Create a file .gitignore in the root of your repository, with the following simple content:
/path/to_your/folder
Add the file to your repository:
git add .gitignore
Remove the folder from your repository (this won’t physically delete the folder):
git rm --cached /path/to_your/folder
Commit
git commit
After that, the folder should be removed from your repository and subsequent changes in it will be ignored by git.
Sounds like Heroku is cleaning out every file not checked in to your Git repository when you deploy. Modify your app to save the bookmarklets to a directory outside of your Git repository.
#poke's answer is mostly correct, but the leading slash in the path name is problematic so I'm posting revised instructions.
The following steps assume the subdirectory inside your git repository is named foo.
Make sure you're at the top level of your Git working directory:
cd "$(git rev-parse --show-toplevel)"
Add foo to your top-level .gitignore file:
echo /foo/ >>.gitignore
The leading slash says to ignore foo in the top level but not */foo or */*/foo, etc. The trailing slash says to ignore foo if it is a directory, but not if it is a file or symbolic link.
Stage the newly modified .gitignore:
git add .gitignore
Commit:
git commit -m "Add foo to .gitignore"
Stop tracking the contents of the foo directory in the Git repository:
git rm -r --cached foo
The --cached option tells Git to not delete the foo folder from your working directory.
Commit:
git commit -m "Remove the foo directory"
Add the following to your .gitignore:
path/to/ignore/**/*
If there are already tracked files on that path, they won't be ignored.
You'll have to run
git rm -r --cached path/to/ignore/

Naive Git setup, Is it possible to untrack files which are listed on my .gitignore?

I have made a naive mistake while setting up my project. We are 3 developers working on one remote repository. While setting up git we never thought that Xcode would produce non-development files and push them to our remote repo. Now once I learnt after crash and burn I made a .gitignore file.
.gitignore looks like this, please do let me know if I should edit this too. (File credit goes too : This question's answer given by Abizem)
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
But now question is there any possibilities that I can untrack all of those listed files from our source control?
or
Can I list all tracked files with their path and later I know a painful way to remove one by one with,
git rm --cached 'file path'
Something I've done a few times in these situations, is move all of the files in the repository somewhere else on the filesystem (except .gitignore), then run:
git add --all
git commit -m "Remove all files"
Then add your files back in and run the following:
git add --all
git commit -m "Re-add files"
This second add & commit will adhere to your gitignore file.

Resources