Xamarin Git ignore

Having completed the Xamarin University classes required for certification I wanted to add them to source control using GitHub.

After installing GitHub Desktop I created a new repository and started to add my Xamarin University projects. I noticed that there were a lot of files ready to commit which I didn't want in version control and remembered (I've been using TFS mostly for the last couple of years) that I would need to setup a .gitignore file.

After some Googling around I found a couple of useful examples, the first being from Adam Wolf. The second was from Michael Hutchinson (linked in Adam's post) in the Xamarin Forums.

Xamarin Studio also has an option to use Git for version control when creating a new project, the options are shown below.

Use Git

In most cases the file generated by Xamarin Studio is probably sufficient but having already done some research I thought I should finish the job and combine the various examples.

To that end I have taken the default Xamarin Studio generated .gitignore file and merged the two examples mentioned earlier with this and added the NuGet Packages exclusions as defined in the Github VisualStudio template.

Seems ok so far, any suggestions for improvements would be welcome, I’ve copied the file contents below:-

#Autosave files
*~

# Build/test output
[Oo]bj/
[Bb]in/
TestResults/

# VS sometimes writes these for no apparent      reason
_UpgradeReport_Files
UpgradeLog.*

# globs
Makefile.in
*.DS_Store
*.sln.cache
*.suo
*.cache
*.pidb
*.userprefs
*.usertasks
config.log
config.make
config.status
aclocal.m4
install-sh
autom4te.cache/
*.user
*.tar.gz
tarballs/
test-results/
Thumbs.db

#Mac bundle stuff
*.dmg
*.app

*.swp
*.nib
*.pfx

# ReSharper
*_Resharper.*
*.Resharper

# dotCover
*.dotCover

# NuGet Packages
*.nupkg
# The packages folder can be ignored because of     Package Restore
**/packages/*
# except build/, which is used as an MSBuild    target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
!**/packages/repositories.config

Note the .gitignore file will be hidden by default in Finder. To enable viewing hidden files paste the commands below into a terminal window.

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

To reverse this use the commands below.

defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

Richard Woollcott

Read more posts by this author.

Taunton, United Kingdom