Git Ignore tracked files - github

If any directory is ignored through .gitignore that contains a few important files that are committed to repository but also contains some unwanted temp files which are generated.
What will happen if important file is modified, will this file be ignored by git?

File already tracked in Git are not affected by .gitignore.
Any changes to tracked files will show up in git status.

Related

How can I stop cloning my application files on GitHub?

I want to stop cloning my application files to Github, How can I do that completely and remove the circle status on each solution files?
Environment: Visual Studio for Mac
Are you intending to have git ignore those files completely?
You can use a gitignore file (.gitignore) in the root working directory of your project to specify which files to ignore. In there, specify a filename per line in that file, or a whole directory to be ignored (eg: Shared/*).
You'll also need to remove those files from your git repo, since they've already been committed.
Copy-pasting from here:
Unstage the file
git reset HEAD newfile
Remove the file from git
git rm --cached newfile
Deleting the file will count as a commit, so you'll need to git push once you're done.
Also note that the file(s) and their contents will still exist in the git commit history, so this isn't a good idea if the goal is removing files with sensitive info.

gitignore > some ignored files still added to the repository

I don't understand why ignored files are still added to the repository. Are there some circumstances when files which are in the .gitignore list, can be still added to the repository
I added directory to the .gitignore before I did anything with the project (project is clean, no trucked or untracked files). Then I built the project. During the build process some files were modified. When the build was done, most of the modified files were ignored, but some were added to the repository. I don't understand this git's selectivity.
Usually, files are added to the index when modified if they were tracked before the .gitignore referenced them.
Try:
git rm --cached -r biz/modules/rest-apis/docs/refAddress
Then control that all files are ignored, by selecting one which was added before:
git check-ignore -v -- biz/modules/rest-apis/docs/refAddress/GET_1.0_v4_addresses.json
You should see a .gitignore rule (no output means: the file is not ignored).

.factorypath added to .gitignore is not taken into account

In .gitignore under the same directory there is
.factorypath
/.factorypath
added for eclipse project. But whenever any change occur in this file it is still visible as modified under git or smartgit.
Any idea why ?
Most likely the file .factorypath was added to git before you excluded it in .gitignore. From the gitignore documentation (http://git-scm.com/docs/gitignore):
NOTES
The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use git rm --cached.
To show files currently tracked by git you can use git ls-files.
As stated in the quote above to stop tracking the file use:
git rm --cached .factorypath.
This will keep your working tree copy of the file but remove it from the index.
It's because the file was previously tracked. With that in mind, this question already has been answered here.

Merging conflict with Unity Script Assemblies

I want to be able to merge my changes to the main repository branch. I accidentally merged all my Unity files on the last merge and I think that caused an error for my next merge . I get the following error:
% hg --repository C:\kiln\development merge --verbose --tool=internal:fail 4595
~/Assembly-CSharp-Editor.pidb: untracked file differs
~/Assembly-UnityScript-Editor.pidb: untracked file differs
~/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll: untracked file differs
~/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll.mdb: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll.mdb: untracked file differs
abort: untracked files in working directory differ from files in requested revision
I'm not sure what to do now. I was thinking about deleting those files from my local repository and then pulling from the main repo. However, I'm afraid those files might damage my game somehow.
What should I do?
In general you should not check the Library folder into Mercurial. From the Unity Manual:
When checking the project into a version control system, you should add the Assets and the ProjectSettings directories to the system. The Library directory should be completely ignored - when using external version control, it's only a local cache of imported assets.
(see also http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html)
Specific to your question: All dll and mdb-files in the Library/ScriptAssemblies folder are automatically regenerated from your code files so you can safely delete these files. Unity will regenerate them when it's recompiling the code in your project.

Ignore changes to files that are already in repository

Adding files to .hgignore will prevent them from being tracked. But we have some files that we want to be in the repository - we just don't want users to ever commit changes. Is there a way to ignore changes to these files, so they won't get committed in an hg commit.
That cannot be done in Mercurial — a file is either tracked or untracked (and then optionally ignored). You should instead version a template file and then ignore the real file.
So add config.template to version control and add config to .hgignore. Ask your developers to copy the template to the real name and customize it as needed.