Guide:Git: Difference between revisions

From Game Making Tools Wiki
(Created)
 
(Info on meta files .gitignore and .editorconfig)
Line 2: Line 2:


==Basics==
==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:
* <code>NUL> .gitignore</code> to create a new file.
* <code>REN [existing file] .gitignore</code> to rename a file you've already made.
To open a command prompt at your current location in Windows Explorer just type <code>cmd</code> and hit <code>Enter</code> in the location bar. You can jump to the location bar quickly with either <code>F4</code> or <code>Alt+D</code>
===.gitignore===
The '''.gitignore''' file is a list of files and directories that will not be uploaded to [[Distribution:Git|Git]].
They can live multiple places, so you can exlude things globably, or per-project.
====Examples====
* https://git-scm.com/docs/gitignore (docs)
* https://github.com/raysan5/raylib/blob/master/.gitignore
<pre>
# comment
*.ext
file/path/
directory/
[Cc]ase
</pre>
===Specific useful things to ignore===
====Unity====
So for Unity game you probably want to ignore those .pdb files.
* https://gist.github.com/octocat/9257657
<pre>
# Visual Studio / Unity
*.pdb
# Temp files
*~
</pre>
===.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:
<pre>
root = true
[*]
indent_style = tab
indent_size = 4
</pre>
The <code>[*]</code> is specifying which files to apply the arguments too (so you can enter specific extensions with, say:
<pre>[*.{html,md}]</pre>


==See Also==
==See Also==
* [[Distribution:Git]]
* [[Distribution:Git]]
* [http://ohshitgit.com/ Oh shit, git!] - Cures for tricky git problems.
* [http://ohshitgit.com/ Oh shit, git!] - Cures for tricky git problems.

Revision as of 07:24, 3 April 2018

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