Does Xcode 11 and its new frameworks like SwiftUI demand changes to .gitignore? - swift

I peaked into the .gitignore file that was in the SwiftUI example projects and found this. Should I add it to the current swift,macos template I pull from git? I'm not so concerned as I am curious whether it's superfluous.
I have copied and pasted it under the templates ##Various Settings xcuserdata/
This is what I copied:
/.xcodeproj/project.xcworkspace/
!/*.xcodeproj/project.xcworkspace/xcshareddata
/.xcodeproj/project.xcworkspace/xcshareddata/
!/*.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
/.playground/playground.xcworkspace/
!/*.playground/playground.xcworkspace/xcshareddata
/.playground/playground.xcworkspace/xcshareddata/
!/*.playground/playground.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings

Nope. .gitignore tells git which files (or patterns) it should ignore. It's usually used to avoid committing transient files from your working directory.
You can find an official gitignore example for Swift here. You can use it, by default ;)
I also recommend reading about git: What is git

Related

Can I use .gitignore with TFVC?

I started using TFVC recently. I was wondering if I can use .gitignore file with TFVC? I am keeping asp.net code in the repository and don't want build related files and folders to get checked in.
If you are using local workspaces you can use a .tfignore that follows the same format as .gitignore.
Follow this for more details
Note: The exact use case is not supported by TFVC.
Yes, in my experience you can use .gitignore file in TFVC. It should work the same. If you want information about how to get the .gitignore file, you can refer the following link -
https://cache404.net/2020/06/04/getting-and-using-gitignore/

How to prevent a folder from being pushed to mercurial repository?

my problem is quite simple: there is a folder in my project which I want versioned, but not pushed along with the rest of the project when I push updates. The situation is that I made an Android app stub along with the project, and I don't want to push it until it is actually somewhat functioning. It's a pretty bulky folder.
I do not want to make a separate branch for that folder, because of two problems: firstly, updating that branch whenever I pull from remote will require a merge; secondly, swapping between the two branches requires noticeable waiting time as the thousands of Android files are created/deleted, and this is very annoying to me.
I was thinking about editing .hgignore in some way, but I think it is wrong that the remote repo will then have my local folder as ignored.
Any suggestions?
You can add this snippet to your repo's hgrc file:
[ui]
ignore = /path/to/.hg/hgignore
where the point about this hgignore file is that it is non-versioned and local to you. The contents hgignore can be anything that would also be suitable for the (versioned) .hgignore. e.g:
syntax: glob
/directory/to/ignore
The name of the file, hgignore, can be called anything, but it's what I use.
You can use the configuration [defaults] section to add some "--exclude" options to usual commands (see my answer to Mercurial hg ignore does not work properly ) for more details. You can even specify which files you do not want to commit in your directory, e.g., stub/**.c for all C files in the hierarchy of directories below stub.
But.. be careful that it is dangerous to silently ignore modifications to files and also that this [defaults] section has been marked as deprecated (it is still present in 2.9.2).
If this is a temporary situation, it would solve your problem though: you would just have to remove the --exclude parts when you feel ready to commit and push your stub.

important files are not in list , all some files go in untract files list?

I am using a Git Repository to manage my project,
Now when i try to commit i see there are some impoertant file like content/image , scripts , etc files in untrack files
Why?
Is there any way to resolve this?
Regards,
vinit
You have to use "git add [wildcard or directory or file(s)]" first to add your files to the versioning system GIT. Manual page is here: https://www.kernel.org/pub/software/scm/git/docs/git-add.html
And the git book is worth a read.
Also I liked gitready very much.
Happy coding
If your Git repo has been initialized on GitHub (and then cloned), it is likely to come with a .gitignore (as well as a README.md, and even a LICENSE file).
Check if those files aren't ignored by the rules in the .gitignore.
You can do that with:
git check-ignore -v scripts
You can edit that file to remove the rules you don't want, then a git add . will add:
the modified .gitignore files
the files that were previously ignored.

Which files/directories to ignore in a Laravel 4 project when using version control?

I have a Laravel 4 project, and I would like to know which files should be ignored when using a version control software such as Git, Mercury or SVN?
The structure of my project looks like the following screen capture.
I'm pretty new to Composer so I'm not very clear about what goes to a repo what not. If someone can post their .gitignore file or their SVN ignore property, it could be handy.
For reference, that .gitignore file can be found here:
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock # Remove this one after you create a project
.env.*.php
.env.php
.DS_Store
Thumbs.db
As noted in the below comment, you probably want to commit composer.lock in your project. Laravel ignores it by default so the authors of the laravel/laravel package don't accidently impose packages on you.
Your project should include the composer.lock file so you can install packages of stable versions (via composer install instead of composer update) properly in your production environments.
Note that the config file:
app/config/app.php
Has a cryptographic key in it that wouldn't be great to commit to a repository. Or, at least, the file needs to be overwritten in production.
You might also want to see the Laravel docs here and here. This discusses how to setup different Laravel configurations for different environments and protect sensitive information. All your .env.local.php type files should not be included in version control. Note that the .env.*.php and .env.php is added in the default Laravel .gitignore file. You can see it here
Laravel has posted their .gitignore on GitHub, which can be found here.
As of today, it looks like this:
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
Thumbs.db
GitHub has a repository of suggested .gitignore files for almost all kinds of projects at: http://github.com/github/gitignore
Alternatively, you can search it for your project using this handy and extremely useful online tool: http://www.gitignore.io

Half-ignored files in VCS - is this supported?

I am using Eclipse and Subversion for Java development, and I find myself wishing for a feature in version control systems (one that is not available in SVN, to the best of my knowledge).
I would like my project settings files to be half-ignored. To be more precise, I want them to be available in VCS, I want merge to occur when someone checks in changes, but. I want my own changes ignored unless I very explicitly tell the system to take them.
This would allow me to have my local paths (and other settings) in my local configuration w/o screwing up other people's configuration. But, when I have a substantial change, I can still check it in (very very carefully, may be temporarily removing my other local changes) and have it delivered to other people.
Now, the actual question: is there any VCS that supports this feature? Or may be I am missing something in SVN? How do other people solve this problem in Eclipse?
Yes, Git support that feature through filter driver (a clean script can run upon commit, allowing you to clean the content from any of your changes if you want).
But another way would be to never version that setting file, and only version:
a template file
a value file
a script able to replace variables in the template files with the values from the value file, in order to generate the actual (and "private", as in "not versioned") setting file.
That way, you can modifying it at your heart's content without ever committing your changes.
.gitignore for git, .hgignore for mercurial and file paths and patterns can be added that will not be committed. There similar in SVN but i never worked out how to use it myself but my sysop did set it up form me.
git supports this with
git update-index --assume-unchanged <file>
and the complementary
git update-index --no-assume-unchanged <file>
See http://blog.pagebakers.nl/2009/01/29/git-ignoring-changes-in-tracked-files and http://kernel.org/pub/software/scm/git/docs/git-update-index.html#_options for more details.