-
Notifications
You must be signed in to change notification settings - Fork 1
Lesson 1: Intro to Git & GitHub
Read through and complete the Tooling Setup and Java evaluation task.
- Clone the training-2026 repo, and open it.
- Understand the Git flow well enough to make a branch, commit, pull, and open a PR later.
- A version control system
- Tool that tracks different versions of your code over time
- Runs locally on your computer
- Tracks changes in files
- Lets you go back to previous versions
- A website that hosts your Git repositories online
- Makes it easier to collaborate
- Keeps your work backed up in the cloud
- Allows for code reviews, comments, and teamwork
- (This is the website where you joined the training-2025 repo)
- Prevent losing work
- Collaborate without overwriting each other’s code
- Track changes and history
- Experiment safely with new features
-
Repository (repo): Project folder tracked by Git
- Example:
971-software-training-2025
- Example:
- Commit: A snapshot of the latest changes of the source code to the repository
- Branch: A parallel version of the repo that allows you to work on new features or fixes without affecting the main codebase
- Merge: Combining changes from one branch into another
- Push: Upload local changes to GitHub
- Pull: Download changes from GitHub
-
Clone the repo (completed last lesson)
-
Create an issue
-
Write code
-
Fetch changes from main and merge them into the current branch
git pull origin main -
Add modified files to your next commit (stage)
git add . -
Record the changes in the staging area in the repository with a descriptive message
git commit -m "Your commit message" -
Push your branch to GitHub
git pushNOTE: If pushing on a local branch for a new time,
git pushwill give you this error:fatal: The current branch my-feature-branch has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin my-feature-branchThen, if you follow that advice and run:
git push --set-upstream origin my-feature-branchGit will push the branch and say something like:Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 500 bytes | 500.00 KiB/s, done. Total 5 (delta 2), reused 0 (delta 0), pack-reused 0 remote: remote: Create a pull request for 'my-feature-branch' on GitHub by visiting: remote: https://github.com/your-user/your-repo/pull/new/my-feature-branch remote: To github.com:your-user/your-repo.git * [new branch] my-feature-branch -> my-feature-branch Branch 'my-feature-branch' set up to track remote branch 'my-feature-branch' from 'origin'. -
Click on the link given in the Git message above to open a Pull Request (PR) and add reviewers
- When you
git pushfrom a branch, GitHub should give you a link to create a PR - If not, you can press the "Contribute" button from the branch to make a PR
- When you
-
Team reviews and merges it into main
Note: Never commit directly to main
- Go onto main & update main to its most recent version (starts your directory with the most recent code)
git checkout main git pull - Make a new branch off main to put your future changes on
git checkout -b branch-name - Make changes then commit & click the link given when you push to make a PR
(follow the advice for git push)
git add . git commit -m "your commit msg" git push - Make a new branch for every task in the training program, and every feature/fix you make in the codebase
- You have some commits on your old branch that are part of what should be in another branch
- Identify the commits that you want on your new branch
git log --oneline
- Create a new branch from main (make a clean branch)
git switch main
git pull origin main
git checkout -b lesson-3
- Cherrypick/add the commits from your old branch to your new branch
git cherry-pick <commit-hash> # the commit hashes you noted down from the git log command
- Push your changes to your new branch & click the link it gives you to make a PR
git push --set-upstream <new-branch-name>
- Remove commits from old branch (do for all commits cherrypicked)
git revert [commit hash]
- Push your changes to your old branch
git push
- Clone (make a copy) of an existing repo
git clone <repository-url> - Add modified files to your next commit (stage)
git add . - Record the changes in the staging area with a descriptive message
git commit -m "Your commit message" - Upload local commits to a remote repo
git push origin main - Fetch changes from a remote repo and merge them into the current branch
git pull origin main - Show the commit history for the branch
git log - Switch to the main branch
git checkout main - Create a new branch and switch to it
git checkout -b <github-username>/<issue-number>-<short-description> - Temporarily store staged changes
git stash - Restore the stashed changes
git stash pop - Show differences of what has changed but hasn’t been staged
git diff
Git Cheat Sheet: education.github.com/git-cheat-sheet-education.pdf
-
Review this page for contributing guidelines: (Pay special attention to the branch naming guidelines)
-
Peer reviewing: All code should be approved by:
- One person knowledgeable in the area that the code affects
- One other person
-
Use GitHub Projects to track issues and progress: https://github.com/orgs/frc971/projects/9/views/7
- Pull often to avoid merge conflicts
- Commit frequently with meaningful messages
- Ask for help when you’re stuck
- Review PRs respectfully and constructively
- Push your solution for the Java evaluation project onto this repo in tasks/java-evaluation/
- Create a PR and add reviewers
- Peer review 2 other people’s work (give comments)
- Resolve any comments that were given
Remember to follow the contributing guidelines!