Github for Unity

Installing and Using Git for Unity on an existing project.

BACKUP YOUR PROJECT FROM THE ROOT FOLDER FIRST!!!

  1. Go to the Asset Store and Search GitHub
  2. Click “GitHub for Unity”
  3. Click Download
  4. Click Import
  5. Click All then Import
  6. After it’s all installed, you will get a pop-up to install the new version, do this.
  7. Same thing, All then Import.
  8. After that is done, reboot your computer.
  9. Click Window à GitHub
  10. That opens an initialize window.
  11. Click “Initialize a git repository for this project”
  12. When that finishes, you get the History tab showing you have an initial commit.
  13. Click Window > GitHub Command Line
    1. If this gives you a blank cursor (I get this with GitHub Desktop installed)

      1. Open the command prompt.
      2. Change directory to the main project folder.
  14. Type “git add -A”

    1. This may take some time to run depending on project size.
      1. You will also get some warnings.
  15. Next type “git commit”.
  16. 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.
  17. Finally type “git push” and let that finish. If it errors, that’s ok.
  18. Now when you make changes you will see those in the changes tab.
  19. 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]”.
  20. Now I continue my changes. One change at a time. When something breaks you click History on the GitHub tab.
  21. Right click on the change that was good and click “Revert”
  22. 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.


Comments

One response to “Github for Unity”

  1. There are several times where adding big assets will make it seem broken. There is a bug where when the changes are big the changes window won’t update. All you have to go is go back and complete steps 13, 14, and 15. You will then see you have a commit to push in the GitHub window.

Leave a Reply

Your email address will not be published. Required fields are marked *