Guide:Git

From Game Making Tools Wiki
Revision as of 07:24, 3 April 2018 by Rjt (talk | contribs) (Info on meta files .gitignore and .editorconfig)

Help using git!

Basics

Meta Files

You can add certain dotfiles (filenames that start with a dot, they're a Unixy thing) to tell git to do certain things with your project. The most common is .gitignore, which tells git to ignore certain files and folders in your working directory.

It's a little bit fiddly to make dotfiles on windows, but you can do so in the command prompt. Either:

  • NUL> .gitignore to create a new file.
  • REN [existing file] .gitignore to rename a file you've already made.

To open a command prompt at your current location in Windows Explorer just type cmd and hit Enter in the location bar. You can jump to the location bar quickly with either F4 or Alt+D

.gitignore

The .gitignore file is a list of files and directories that will not be uploaded to Git.

They can live multiple places, so you can exlude things globably, or per-project.

Examples

# comment
*.ext
file/path/
directory/
[Cc]ase

Specific useful things to ignore

Unity

So for Unity game you probably want to ignore those .pdb files.

#	Visual Studio / Unity
*.pdb

#	Temp files
*~

.editorconfig

I just use the .editorconfig so when people view the files through the web interface the tabs look right, but you can set other stuff like line ending and character encoding in there too.

Example:

root = true

[*]
indent_style = tab
indent_size = 4

The [*] is specifying which files to apply the arguments too (so you can enter specific extensions with, say:

[*.{html,md}]

See Also