# Git for Busy Engineers
A critical tool for engineers in many fields, git keeps track of changes to source code.
## Terminology
Repo — repository, another name for a folder that is being tracked by git.
## Step 1: Download Git
Visit [https://git-scm.com/downloads](https://git-scm.com/downloads) and download the most recent version for your operating system.

## Step 2: Download Github Desktop
Visit [https://github.com/apps/desktop](https://github.com/apps/desktop) and download the GitHub Desktop GUI.

This makes viewing git histories etc. slightly easier for those unfamiliar with the command line. It should be noted that git is made for the command line and you should become acquainted with the common commands such as `git add`, `git commit`, `git push` /`git pull` etc.
## Step 3: Setup your global gitconfig file
Set your username and email using github. The easiest way to authenticate is to sign in to a github account.
## Step 4: Setup your global gitignore file
Git should be used exclusively for source code — a gitignore file allows you to only track the source code in a folder (even though there might be lots of other stuff in there). Ignoring large files is also crucial, as git does not perform well above 1GB in the repo. A global gitignore file should be used for files specific to your operating system, code editor and anything else not related to the project: [^global-gitignore]
- System files (e.g. desktop.ini)
- Code editor configuration files (e.g. .vscode)
- Credentials (e.g. usernames & passwords)
To create a global gitignore file (which we call .gitignore_global) in your home directory, run the following commands (all should achieve the same thing).
Git bash:
```bash
git config --global core.excludesfile ~/.gitignore_global
```
Windows command prompt:
```cmd
git config --global core.excludesfile %USERPROFILE%\.gitignore_global
```
Windows Powershell: [^global-gitignore-windows-powershell]
```PowerShell
git config --global core.excludesfile %USERPROFILE%\.gitignore_global
```
## Step 5: Setup your project (local) gitignore file
Use the local gitignore file (found in the root of the project folder where your git repo lives) for any *project* related ignores. [^global-gitignore-source-2]
Github maintains a collection of gitignore templates for each programming language. [^github-gitignore] These can be easily added to a project by running `npx gitignore <template>` (provided you have node package manager — npm — installed). [^gitignore-npx]

## Step 6: Setup git-lfs
As simulations become more complex, the file size increases. For example, a
Github does not allow upload of files larger than 100MiB. [^github-file-size-limitations] To store source code larger than this, git-lfs (“large file storage”) should be used.
Instead of storing the files directly, for stores a pointer to the file.
[^global-gitignore]: [https://sebastiandedeyne.com/setting-up-a-global-gitignore-file/](https://sebastiandedeyne.com/setting-up-a-global-gitignore-file/)
[^github-gitignore]: [https://github.com/github/gitignore](https://github.com/github/gitignore)
[^global-gitignore-source-2]: [https://medium.com/self-modifying-code/create-a-global-gitignore-step-by-step-for-macos-and-windows-31a765291409](https://medium.com/self-modifying-code/create-a-global-gitignore-step-by-step-for-macos-and-windows-31a765291409)
[^gitignore-npx]: https://medium.com/@ericapisani/create-a-comprehensive-gitignore-file-in-seconds-3f65e8b437e
[^github-file-size-limitations]: https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github
[^global-gitignore-windows-powershell]: https://gist.github.com/subfuzion/db7f57fff2fb6998a16c