Skip to content

How to Fork

Thinh Le edited this page Mar 19, 2019 · 1 revision

NOTE This should take about 15 minutes for setup but you'll be well on your way afterwards.

1. Fork

First you fork the repo onto your own profile. Benefits:

  • Maintain your own code base
  • Review before merging
  • Avoid conflict with your own code on collaboration repos
    Step 1 Fork

2. Shell

Now, you need a shell to interact with git through the command line. You could use the github desktop but I HIGHLY recommend learning the shell to familiarize yourself with commands and introduce yourself to Linux development. Step 2 WSL
Step 2 Git
You can get the git bash OR try the Windows Subsystem Linux bash as they both can interact with your current OS files and directories:
git bash
NOTE Choose this option if you do not feel comfortable with command line or you are a beginner.
WSL bash
NOTE for WSL, you must enable Developer mode and run bash to install. When it is setup, you must create a new user adduser <YOUR_NAME> and switch over by su - <YOUR_NAME>. If you already have a linux system or linux VM, you already have a shell installed called 'Terminal'.

3. Basic Shell Commands

cd /mnt/c/Users/$USER/<PATH_TO_SDK>/SRE_SDK_2019/code/VCU/Environment/dev
Try ls to list the files and directories. You can hit TAB to autofill commands, file names, directory names, etc. You can rename the current sre-3b directory to avoid conflict: mv sre-3b/ sre-3b-default/

4. Cloning the repo

Now you can clone your fork to your local system.
Step 4 Clone

Now go to that directory and check it out:

cd sre-3b
git remote -v
git status
git show -s
git branch -a

Results should be similar:
Step 4 Results

5. Basic Branching

BEFORE YOU ADD FILES, create or move to the development branch It should be called 'dev' remotely. You just need to create the branch locally.
git branch dev
git checkout dev
Now you can check if its correct
git branch

6. Uploading/Removing Files

You should know the file structure by now, now you can drag your files into this local repo and commit updates to your remote repo AKA what happens on your laptop can also be shown on the internet when you do a 'push'.

build/
Logs/
PCAN/
README.md
.gitignore
<CODE>  

Please upload or remove necessary code to the section and PCAN Explorer symbols and other files to the PCAN/ directory. Code reviews will be executed locally on the reviewer's machine.

7. The Final Stretch!

For the last steps, you are ready to submit it to the remote repo/your github. You can do the following:
git add -u
Check if your files are actually staged to commit(e.g. ready to send)
git status
If it looks good, now commit
git commit -m "<What did you do>,<the next step in your project>"
Once that is done, check the name of your remote repo by doing
git remote -v
The name should be origin or upstream or your github username, once you figure it out, push!
git push <REMOTE> <BRANCH>