Skip to content
linhenry2004 edited this page Oct 14, 2023 · 1 revision

Welcome to the IRIS_PCB wiki!

IRIS Electrical Team Github Guide

0. How to use the terminal

1) Windows Users

For Windows users, you should look for "Terminal" or "Windows Powershell" in your computer.

1. pwd

Stands for "Print Working Directory". Basically prints which folder you're at.

pwd_win

When you first open Terminal and type pwd, it will return:

C:\Users\<username>

2. ls

Stands for "List files". Prints all the folders you're able to access given the folder you're in currently.

ls_win

In this case, my computer is returning all the folders and files under the C:\Users\linhe directory.

3. cd

Stands for change directory. You can use this to access other directories.

For example: I can use cd IRIS_PCB to access that specific folder. See how I am in a different directory now.

cd_1_win

Suppose I want to go back to the previous directory, I can use cd ..

cd_2_win

Special case: If you're folder name contains spaces, you will use single quotation marks around the file to prevent any errors. For example, if your file is called "My File", then you should use cd .\My File\.

4. clear

Stands for... clear. This clears everything on your terminal so it doesn't look messy.

I believe that for Windows 10, you should use cls to clear terminal instead. However, I am not sure about this. If someone is using Windows 10, please double check and let us know if this is correct.

5. history

Use this to look up past commands you've used. This may or may not be useful for you.

There are a lot more commands, but we will skip those for the purpose of this document. For more information, please refer to the link below.

Again, there are a lot more commands, but we will skip those for the purpose of this document. For more information, please refer to the link below.

For Windows users: https://www.freecodecamp.org/news/command-line-commands-cli-tutorial/

2) Mac Users

1. pwd

Stands for "Print Working Directory". Basically prints which folder you're at.

pwd

When you first open Terminal and type pwd, it will return:

/Users/<username>

2. ls

Stands for "List files". Prints all the folders you're able to access given the folder you're in currently.

ls

In this case, my computer is returning all the folders and files under the /Users/henrylin directory.

3. cd

Stands for change directory. You can use this to access other directories.

For example: I can use cd IRIS_PCB to access that specific folder. See how I am in a different directory now.

cd_1

Suppose I want to go back to the previous directory, I can use cd ..

cd_2

Special case: If you're folder name contains spaces, you will use backslash to prevent the terminal from returning a bug.

backslash

4. clear

Stands for... clear. This clears everything on your terminal so it doesn't look messy.

5. history

Use this to look up past commands you've used. This may or may not be useful for you.

Again, there are a lot more commands, but we will skip those for the purpose of this document. For more information, please refer to the link below.

Mac Terminal Guide: https://www.taniarascia.com/how-to-use-the-command-line-for-apple-macos-and-linux/

1. First time using Github

(Tutorial taken from ECE120/220 Documents)

Step 1: Download the latest version of Git. Link: https://git-scm.com/downloads

Once it is downloaded, you will want to click on it and install. (For settings, just use recommended for everything.)

Step 2: To verify that you've succesfully installed git, I would type git --version on terminal. This should return the version of Git you have. If no errors are shown, git has been successfully installed.

Step 3: Setup Github username and email

Use:

git config --global user.name "<username>"

git config --global user.email <your_email>

With < username > and < your_email > replaced with your Github username and email.

If you've done the above steps, you have successfuly setup Github on your device. If you ran into any problems, feel free to let us know.

2. Clone Repository

To clone the repository, you will need to open on terminal, go to the directory you want to files to be stored in, and type:

git clone https://github.com/IllinoisRoboticsInSpace/IRIS_PCB.git

Then, you should have all the files downloaded. Use cd IRIS_PCB to enter the folder.

This is where you should work on your KiCad projects. Next, we will look at how you should properly push these files onto Github.

3. Push documents onto Github

Step 1: PULL BEFORE PUSH!!!

The first thing you want to do, and the most important thing of all, is git pull.

Since we are the 20-people team, many people are constantly pushing new files into our repositories. Therefore, if you do not pull before push, you might overwrite other's work. It is also good practice to pull before push.

Step 2: Go to the correct branch

Next, you want to make sure you are at the correct branch.

If this is a new project, there might not be a branch on Github. To create a new branch, use git branch <branch_name> to setup a new branch. Next, push the new branch onto Github using git push -u origin <branch_name>. With that, you can continue pushing your files onto Github.

You can use git branch -a to see which branch you are in.

branch

The asterik (*) indicates the branch I am in.

If you're not in the correct branch, use git checkout <branch_name> to move to other branches.

Keep in mind that you should never try to push onto the main branch. Only the team leads have permission to edit the main branch. This is to prevent individual project teams from editing the same files and also to hide the main branch from all the unfinished projects.

Here is a brief idea of Github branches. The master branch is our main branch, and we can add as many branches as we like.

branch idea

Once we are done with our project, we will make a "Pull Request" to the main branch to merge the two branches. Refer to Part 4 for more information.

For more information on Git Branches, feel free to refer to https://www.youtube.com/watch?v=QV0kVNvkMxc&ab_channel=NetNinja

Step 3: Stage your files

There are three steps to pushing your file onto Github. They are: stage, commit, and push.

We can use git status to check any modified, added, or removed files.

Next, we can use git add <filename> to stage these files.

If youe ever made a mistake, you can use git restore --staged <filename> to unstage the files.

Once you have the files added, you can type git status again to make sure they are staged.

stage

Notice how the staged files would turn from red to green. This is how you can make sure the files are staged.

Step 4: Commit

Next, you will commit the files.

git commit -m "<Some_comments>"

Remember to write something short but meaningful for the comments. For example, instead of writing "update", you could write "update resistor values".

Step 5: Push

Finally, you can push it onto Github. You can do this by using git push.

You should always check the github repository to make sure the changes have been pushed.

4. Make Pull Request

If your project team has finished your design for the PCB, you should make a pull request to merge your branch into main. To do this, go into the repository on github.com.

Click on Pull Requests > New Pull Request.

In here, you should select the branch you are pull from (Usually your project branch), and the the branch it should merge into (Usually the main branch).

Next, click on Create Pull Request. For the comments, you could write something explaining your circuits, although it is fine to leave it blank as well.

Once you've written your comments, click on Create Pull Request. This will send an email to the project leads, which they will look over the files and decide whether to merge the files or not.