CodeX
Published in

CodeX

Create git ignore file for Swift and Xcode development

if you are into developing, you should be using source control. Source Control (version control) is the practice of tracking and managing changes to code. However, you might have troubles adding files that you should not be tracking like personal Key, hidden system files and personal IDE settings.

if you are using git, you can simply make git ignore files to untrack files. For a .gitignore file, you should place it in the root folder of the repository.

How to create a git ignore file?

Go to website gitignore.io and give the keywords depending on your project. For example, I’m using Swift so my keywords would be Swift, CocoaPods, and the tool for Xcode.

then click produce,

when you see above the file, copy it and do the below steps before paste it. if you want to customize it, then add or delete some of the lines. For example, to hide a .swift file, simply write file name in it.

then Open Terminal or Git Bash for Windows and go to the file directory where you wanna create a git ignore file.

1️⃣ Create a .gitignore file for your repository.

touch .gitignore

2️⃣ edit your .gitignore file

vim .gitignore

3️⃣ Now you will see the terminal like this, then paste it!

4️⃣ to save and quit → :wq

:wq

5️⃣ you are now ready to use git ignore file 👏🏻

💡 oh, don’t forget to push it to your git and git status to check it the file is being tracked or not 🙌🏻

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store