-
Notifications
You must be signed in to change notification settings - Fork 1
Configure Your Existing Codebase With Git
Hexic Pyth edited this page Mar 8, 2019
·
9 revisions
- Backup your source code.
Now, with that out of the way:
-
Install Git For Windows. Please Select the Following non-default parameters during installation:
Git from command-line and also 3rd-party softwareUse the native Windows Secure-Channel Library
-
Open VS Code and Click the
WPILib button -
Create a new VS Code Project
- Type
Create A New Projectand strike theEnterkey - Click
Select a Project Type (example or template) - Select
Template - Select
Java - Select
Command RobotLeft-Click `Select a New Project Folder'* - Navigate to wherever you want your project to be stored. Throughout this example, the project will be stored under
C:/Users/user/Desktop/, under aDeepSpacesub-directory. - Enter
DeepSpaceinto theEnter Project Namefield - Enter
3236in theTeam Numberfield - Click
Generate Project- In this example, this will create the folder
C:/Users/user/Desktop/DeepSpace, containing default code for a Java-based Command-Robot.
- In this example, this will create the folder
- Type
-
Delete the existing
srcdirectory- Click the
Start Buttonand enterPowershellorcmd.exeor [insert name of favorite terminal here] - Navigate to the directory you created your new project in. In this example, we will use the following command:
cd C:/Users/user/Desktop/DeepSpace
- Delete the
srcdirectory.- Windows users will type:
del src
- Windows users will type:
- Click the
-
Initialize and clone your branch of this repository into the working directory
- Open your terminal from Step 4 and run the following commands
git initgit remote add origin https://github.com/FRC3236/DeepSpace.gitgit fetchgit pull origin master --rebase-
git checkout -t origin/master -b [enter_your_GitHub_username_here]- example: `git checkout -t origin/master -b HexicPyth
- Open your terminal from Step 4 and run the following commands
-
copy the code you backed up in step 0 to your new branch, the lazy way
- Assuming your backup was stored at
C:/Users/user/Desktop/BackupOfDeepSpace, and your new project directory isC:/Users/user/Desktop/DeepSpace:- Using the terminal from Step 4 and Step 5, execute:
-
del src(again) -
DOS-Style Command-Line Utilities/Syntax is/are stupid, so instead of bothering with them, just use Windows Explorer to copy
C:/Users/user/Desktop/BackupOfDeepSpace/srctoC:/Users/user/Destop/DeepSpace/src, thus adding the contents of your oldsrcdirectory to your newsrcdirectory
-
- Using the terminal from Step 4 and Step 5, execute:
- Assuming your backup was stored at
-
Push your code to your new branch, the lazy way
- Using your terminal from step 4, step 5, and step 6, type:
git add ./srcgit commit -m "First commit"-
git push origin [your branch name, see Step 5] -f-
example:
git push origin HexicPyth -f
-
example:
-
If at any point git tells you to
Please tell me who you are:- run
git config --global user.email [your github email] - run
git config --global user.name [your name]
- run
- Using your terminal from step 4, step 5, and step 6, type:
8. Oops, there is no step eight. Just open your new project folder in VS Code, and your project is now configured with git. You can pull any newest changes with git pull origin master, and push your changes with the sequence of commands mentioned in Step 7.