| 1 | Git is like the google docs of software development. It helps track changes in code when multiple people are working on the same set of files. |
| 2 | |
| 3 | Make sure to download git on windows at: |
| 4 | https://git-scm.com/download/win |
| 5 | |
| 6 | Download for git on Mac is at: |
| 7 | https://git-scm.com/download/mac |
| 8 | |
| 9 | While we can use the Git download for software development, VSC, the environment you have been using to write and run your code, has built in commands for git which we will be using for this tutorial. |
| 10 | |
| 11 | Now create an account on Github. |
| 12 | |
| 13 | Example 1: |
| 14 | 1. Go to: https://github.com/Team2537 |
| 15 | 2. Navigate to RookiesTest |
| 16 | 3. Click the clone or download green button and copy the URL |
| 17 | 4. Open up FRC VS Code |
| 18 | 5. Press: Ctrl + Shift + P (A search bar will pop up) |
| 19 | 6. Type in "Git: clone" and click once it emerges |
| 20 | 7. Paste the URL from the github website and press enter |
| 21 | 8. A tab will appear at the bottom right of the screen. Press "Open Repository" |
| 22 | |
| 23 | You have just cloned your first repository! By using VSC and the GitHub website, you've made a copy of the code on the website. |
| 24 | |
| 25 | Team Development Commands |
| 26 | For git to be truly effective, you have to be able to make changes as a team. |
| 27 | Commands include: |
| 28 | - git commit - once you've edited your copy of code, this command records your changes and lets you leave a note. |
| 29 | - git add - adds new files you've created inside the code. |
| 30 | - git push - this command uploads your committed changes to the main repo on the website |
| 31 | - git clone (what we first used) - creates a copy on your computer not effected by other people's edits |
| 32 | - git merge -when two or more users make changes at the same time, conflicts will occur. VSC will ask you if you'd like to merge, meaning combining users' codes and having you manually edit any errors. |
| 33 | |
| 34 | Other terminology: |
| 35 | - Branches - when you want to focus on different assets in the code, it may be best to create a branch. This way, you won't have to deal with merge conflicts and can commit your changes freely. For example, often in our robot code, we will have a branch devoted to Arm mechanism or Autonomous version. Check the SpaceBase Repository on https://github.com/Team2537/Spacebase and click on the left-most white button "Branch: Main". Explore the other branches what differences or similarities do you see? |
| 36 | |
| 37 | |
| 38 | |
| 39 | |