Uploading code to Github using GitHub Desktop

I already graduated high school but next year’s team needs last season’s code to show off our robot in school meetings. However, I don’t know anything about Git and I just want for my team to access the code and download it so I just downloaded Github Desktop. I’m very confuse on how to this process works. Could anyone help me?

I think you can make a new repository in the Desktop app, which will ask you to select a folder. Then just pick the folder with your code.

To be fair, if they don’t need to change any code, they can actually just drive the code on the robot as-is. Otherwise, you should actually be able to upload the entire folder as priorly mentioned. (truth be told I never bothered much with the Desktop app, just jumped straight to CLI)

If the code is public on Github, they should be able to find it online (if not, there should be a way to share it with them. I personally don’t know how because I don’t manage my team’s Github page). They need to clone the repository that has the code (this saves the code on their computer). Using Github Desktop, they should be able to switch between branches in the repository. They should make a new branch that is a copy of branch with the working code if they’re going to make any changes. That way, the code in the first branch is unchanged. (You probably won’t need to do that if you’re only showing off a robot that already works, but it’s helpful to know if you don’t have experience with Git. You can prevent code from being ruined by freshman.) Anyway, you should be able to open the Git project in VSCode after the repository is on the computer and set to the right branch.

Sorry if this was confusing still. It’s hard to explain Git in a paragraph because there’s other things involved like pushing, pulling, committing, etc. that probably weren’t important with what you needed it for. I also don’t know how much experience you may have with it.

Is your code already in GitHub or does it exist on your computer only? The steps to share code with your team will vary depending on your answer.

Ah okay thank you!

Yeah the code already is in my computer

I wrote this up ages ago but the work flow still works.

1 Like

If your plan is to just put it up all at once and not use it for version control, here are the git commands you need. For simple stuff like this, it is easier to use git command line than using a git GUI like GitHub Desktop.

cd into your folder with the robot code (copy this folder just to be safe).

git init in your folder to create a git repo

Optionally download a gitignore file from https://www.gitignore.io/api/c++,java,linux,macos,gradle,windows,visualstudiocode. Gitignore files will ignore certain unnecessary files such as build files that don’t need to be uploaded. This might make things more complex for you and you might not want to do it if you only plan to upload once.

git add . to “stage” all files to be committed. This means that when you use the commit command, it will use changes to all files (that is what the . represents)

git commit -m "Initial Commit" to commit your staged changes. This adds every files data to a new “commit”, which is a change locally stored on your computer.

git remote add origin [URL TO YOUR REPO] to add your repository as a remote.

git push origin master to push to the remote.

These are the basic steps to commit and push all your files to a remote.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.