<rss version="2.0">
  <channel>
    <title>xcode on dBlog</title>
    <link>https://www.tartanhare.com/categories/xcode/</link>
    <description></description>
    
    <language>en</language>
    
    <lastBuildDate>Sun, 13 Mar 2022 19:04:54 +0000</lastBuildDate>
    
    <item>
      <title></title>
      <link>https://www.tartanhare.com/2022/03/13/til-xcode-can.html</link>
      <pubDate>Sun, 13 Mar 2022 19:04:54 +0000</pubDate>
      
      <guid>http://dgs.micro.blog/2022/03/13/til-xcode-can.html</guid>
      <description>&lt;p&gt;TIL - Xcode can display build time right there in the activity view:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Command line preference settings. Living in the future.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Preparing to Ignore Files with Git and Xcode</title>
      <link>https://www.tartanhare.com/2021/04/05/preparing-to-ignore.html</link>
      <pubDate>Mon, 05 Apr 2021 20:47:00 +0000</pubDate>
      
      <guid>http://dgs.micro.blog/2021/04/05/preparing-to-ignore.html</guid>
      <description>&lt;p&gt;Source code version control is a core competency of the modern developer. But sometimes the system and the environment can get in the way.&lt;/p&gt;
&lt;p&gt;When using &lt;a href=&#34;https://developer.apple.com/xcode/&#34; title=&#34;Xcode information pages, Apple Developer web site&#34;&gt;Xcode&lt;/a&gt; (or other tools) with services such as &lt;a href=&#34;https://github.com&#34; title=&#34;GitHub, the world&#39;s most popular git implementation, now owned by Microsoft&#34;&gt;GitHub&lt;/a&gt; the default situation is to associate a folder with a new repository, including all files and subfolders contained within. This might also include some files or folders you might not want to include.&lt;/p&gt;
&lt;p&gt;For example, macOS uses hidden files named &lt;code&gt;.DS_Store&lt;/code&gt; (Apple&amp;rsquo;s &lt;a href=&#34;https://en.wikipedia.org/wiki/.DS_Store&#34; title=&#34;.DS_Store, Wikipedia&#34;&gt;Desktop Services Store&lt;/a&gt;) to manage information about the state of local folders, and Xcode places files in &lt;code&gt;xcuserdata/&lt;/code&gt; folders which trbck the state its own UI.&lt;/p&gt;
&lt;p&gt;Both of these are useful for the local user, but are unlikely to be so for others who might be working on your project code.&lt;/p&gt;
&lt;h2 id=&#34;before-your-first-project&#34;&gt;Before Your First Project&lt;/h2&gt;
&lt;p&gt;If you want to prevent all of your local projects including selected files or folders in their repositories, then you can update Git&amp;rsquo;s global settings.&lt;/p&gt;
&lt;h4 id=&#34;step-one-create-a-gitignore-file&#34;&gt;Step One: create a .gitignore file&lt;/h4&gt;
&lt;p&gt;Create a file named &lt;code&gt;.gitignore_global&lt;/code&gt; in your local user root directory. For example, by using the following command in the Terminal:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;touch ~/.gitignore_global
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note the &lt;code&gt;_global&lt;/code&gt; suffix to highlight to future you that this affects all repositories.&lt;/p&gt;
&lt;h4 id=&#34;step-two-add-the-required-rules-to-the-gitignore-file&#34;&gt;Step Two: add the required rules to the .gitignore file&lt;/h4&gt;
&lt;p&gt;Using your preferred text editor, add the name of each file or folder that you want to be &lt;strong&gt;excluded&lt;/strong&gt; from all of your Git repositories. For the examples above, the file would contain (with #-prefixed comments included):&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# macOS
.DS_Store

# Xcode
xcuserdata/
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There are other options, such as using wildcards, which can be explored as &lt;a href=&#34;https://git-scm.com/docs/gitignore&#34; title=&#34;gitignore, Git documentation&#34;&gt;extended reading&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id=&#34;step-three-configure-git-to-use-the-gitignore-file&#34;&gt;Step Three: Configure Git to use the .gitignore file&lt;/h4&gt;
&lt;p&gt;Use the Terminal to tell Git to use this list of files folders to be ignored when creating &lt;strong&gt;all&lt;/strong&gt; new local repositories:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git config --global core.excludesfile ~/.gitignore_global
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;ignoring-by-project&#34;&gt;Ignoring by Project&lt;/h2&gt;
&lt;p&gt;You might want to ignore files on a project by project basis.&lt;/p&gt;
&lt;p&gt;The process is the same, but in each project root folder you should include a &lt;code&gt;.gitignore&lt;/code&gt; file, formatted as above.&lt;/p&gt;
&lt;h2 id=&#34;fixing-files-that-slip-through-the-net&#34;&gt;Fixing Files that Slip Through the Net&lt;/h2&gt;
&lt;p&gt;If you had already linked your Xcode project via Git, and after setting up your global, or per-project, ignore files, perhaps now have the odd erroneous file such as &lt;code&gt;.DS_Store&lt;/code&gt; in one of your repositories, you can remove the individual files from your repository:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;git rm --cached .DS_Store
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will need done for each rogue file in your local repository, with files being removed from your remote repository on the next &lt;code&gt;git push&lt;/code&gt;.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>