Installing and Using Git for Unity on an existing project.
BACKUP YOUR PROJECT FROM THE ROOT FOLDER FIRST!!!
- Go to the Asset Store and Search GitHub
- Click “GitHub for Unity”
- Click Download

- Click Import
- Click All then Import

- After it’s all installed, you will get a pop-up to install the new version, do this.
- Same thing, All then Import.
- After that is done, reboot your computer.
- Click Window à GitHub
- That opens an initialize window.

- Click “Initialize a git repository for this project”
- When that finishes, you get the History tab showing you have an initial commit.

- Click Window > GitHub Command Line
- If this gives you a blank cursor (I get this with GitHub Desktop installed)
- Open the command prompt.
- Change directory to the main project folder.
- If this gives you a blank cursor (I get this with GitHub Desktop installed)
- Type “git add -A”
- This may take some time to run depending on project size.
- You will also get some warnings.
- This may take some time to run depending on project size.
- Next type “git commit”.

- It will pop up your text editor asking for a commit message. Type “first commit” or similar and save and close your editor. Let it finish.

- Finally type “git push” and let that finish. If it errors, that’s ok.
- Now when you make changes you will see those in the changes tab.

- I want to keep the change I made, because I tested it and everything works so, click the top check box to select all, then on the bottom type a summary of the change in Commit summary and as detailed as you want to be in the description. Then click “Commit to [master]”.

- Now I continue my changes. One change at a time. When something breaks you click History on the GitHub tab.
- Right click on the change that was good and click “Revert”

- Close Unity and Reopen it and your changes are reverted to where you wanted.
THIS DOES NOT REPLACE THE NEED FOR NIGHTLY BACKUPS!!! This provides a faster way to restore back to an unbroken condition.
Git can change you backup strategy if you send up to a remote repository. When you by assets you should never have a public repository you back up to.
Forking is a whole other conversation.
Leave a Reply