[git] How to create a .gitignore file

MacOS / Linux one-liner

An easy way to get a default git ignore without messing about with create/copy/paste is to use the curl command from the terminal. First cd into your projects root directory and then run the command by replacing MY_API_NAME with your API name from one of the following two sources:

gitignore.io

curl -o .gitignore https://www.gitignore.io/api/MY_API_NAME

You can find your API name by searching from the list here and clicking Generate.

Java Example:

curl -o .gitignore https://www.gitignore.io/api/java

GitHub

Alternatively you can use the ones at GitHub. Find the filename for your API here.

curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/MY_API_NAME.gitignore

Java Example:

curl -o .gitignore https://raw.githubusercontent.com/github/gitignore/master/Java.gitignore

Windows

Here are some similar alternatives for Windows.

But honestly setting that up looks like more trouble that it is worth. If I had Windows then I would just create an empty file called .gitignore in my project's root folder and then copy and paste the default text from gitignore.io or GitHub.

Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to xcode4.3

lexical or preprocessor issue file not found occurs while archiving? How to create a .gitignore file Code signing is required for product type 'Application' in SDK 'iOS5.1' library not found for -lPods sudo: port: command not found

Examples related to gitignore

Gitignore not working How to add files/folders to .gitignore in IntelliJ IDEA? Apply .gitignore on an existing repository already tracking large number of files Ignore .classpath and .project from Git .gitignore all the .DS_Store files in every folder and subfolder Correctly ignore all files recursively under a specific folder except for a specific file type What should be in my .gitignore for an Android Studio project? Commit empty folder structure (with git) How to remove files that are listed in the .gitignore but still on the repository? What to gitignore from the .idea folder?