📝
marcyannotes
  • Welcome
  • Student Guidelines & Policies
    • Student Handbook
    • AI Policy
    • Academic Calendar
  • Environment Setup
    • Local Environment Setup - Mac
    • Local Environment Setup - Windows
    • GitHub Setup
    • Postgres Setup
  • Fullstack Software Engineering Curriculum
    • Overview
    • How-Tos
      • How To Code at Marcy: Code Style Guide
      • How to Do Short Response and Coding Assignments
      • How to Debug
      • How to PEDAC
      • How to Create Projects with Vite
      • How to Deploy on GitHub Pages
      • How to Deploy on Render
    • Mod 0 - Command Line Interfaces, Git, and GitHub
      • Mod 0 Overview
      • Command Line Interfaces
      • Git & GitHub
      • Git Pulling & Merging
      • Git Branching & PRs
      • Pair Programming: BONUS
    • Mod 1 - JavaScriptFundamentals
      • Mod 1 Overview
      • Intro to Programming
      • Errors
      • Node & Node Modules
      • Variables, Functions & String Methods
      • Control Flow, typeof, and Math
      • Loops
      • Arrays
      • Objects
      • Higher Order Functions: Callbacks
      • Higher Order Functions: Array Methods
      • Regex
    • Mod 2 - HTML, CSS & the DOM
      • Mod 2 Overview
      • HTML
      • CSS
      • Accessibility (a11y)
      • The DOM
      • Events
      • Forms
      • The Box Model and Positioning
      • Flexbox
      • Grid & Media Queries
      • ESModules
      • LocalStorage
    • Mod 3 - Async & APIs
      • Mod 3 Overview
      • Promises
      • Fetch
      • Building a Fetching App
      • Async & Await
    • Mod 4 - Project Week!
      • Project Week Overview
    • Mod 5 - Object-Oriented Programming
      • Mod 5 Overview
      • Intro to OOP, Encapsulation, Factory Functions, and Closure
      • Classes
      • Private & Static
      • Has Many/Belongs To
      • Polymorphism
    • Mod 6 - Data Structures & Algorithms
      • Mod 6 Overview
      • Stacks & Queues
      • Nodes & Linked Lists
      • Singly & Doubly Linked Lists
      • Recursion
      • Trees
    • Mod 7 - React
      • Mod 7 Overview
      • Intro to React
      • Events, State, and Forms
      • Fetching with useEffect
      • Building a Flashcards App
      • React Context
      • Global Context Pattern
      • React Router
    • Mod 8 - Backend
      • Mod 8 Overview
      • Intro to Express
      • Building a Static Web Server with Middleware
      • Securing API Keys with Environment Variables
      • Building a RESTful API with MVC
      • SQL and Databases
      • JOIN (Association) SQL Queries
      • Knex
      • Your First Fullstack App!
      • Migrations & Seeds
      • Schema Design & Normalization
      • Hashing Passwords with Bcrypt
  • Code Challenge Curriculum
    • Unit 0
      • Lecture: Functions in JS
      • CC-00: Functions and Console Logs
      • CC-01: Conditionals
      • CC-02: Conditionals 2
    • Unit 1
      • CC-03: For Loops
      • CC-04: For Loops and Conditionals
      • CC-05: For Loops and Conditionals 2
    • Unit 2
      • CC-06: String Mutations
      • CC-07: Array Iteration
      • CC-08: String Mutation and Array Iteration
      • CC-09: Array Mutations
      • CC-10: Reading Objects
      • CC-11: Objects
      • CC-12: Objects
      • Unit 2 Diagnostic
    • Unit 3
      • Intro to PEDAC (and Algorithms)
      • validTime
      • fizzBuzz (array)
      • digitSumDifference
      • firstNotRepeating
      • compareEvenAndOddSum
      • countVowelConsonants
      • finalHP
      • canMakeTriangle
    • Unit 4
    • Unit 5
    • Unit 6
    • Unit 7
    • Unit 8
    • Sorting
Powered by GitBook
On this page
  • Setting up Branches
  • Working on a new branch...
  • Pull Requests!!!
  1. Fullstack Software Engineering Curriculum
  2. Mod 0 - Command Line Interfaces, Git, and GitHub

Pair Programming: BONUS

Setting up Branches

Assuming you are already on the directory (or folder) of your repo, this is how you set up a new local branch.

Like with commits, new branches are first created locally, then uploaded or pushed to remote later in the process.

In the terminal:

git checkout -b branchName

This creates a new branch with the name that you specified, and automatically sets it to your current branch.

To check that you have created a new branch and are currently set to it:

git branch -a

You should see the following output:

* branchName
  main
  remotes/origin/main
  • The * denotes the branch you are currently on. In this case, since we used git checkout -b BranchName earlier, it created and set us up on that branch.

  • Branches written in red text means that they are remote branches which currently exist in the remote repository. We'll come back to that later.

Working on a new branch...

All git operations are basically the same even when you are working on a branch. The git commands that we've learned (add, status, commit, and push) will all still work as intended.

Try making changes to your any of your files, and proceed to add, and then commit those changes. BUT DON'T PUSH IT JUST YET.

But before we start pushing our code, we have to make sure that the branch that we made also exists in the remote repo!

Do a git branch -a again just to see all the local and remote branches you have set up!

Our local branch has to match with a remote branch before we can push, and in order to do that, we do the following command:

git push --set-upstream origin BranchName

This command enables the first time you push. All other pushes after this can just be done with git push (no need to include all the other commands!).

Pull Requests!!!

It doesn't end at doing push into your new branch. Remember that branches exist for the purpose of being merged back into main, and mostly acts as a staging area for any new features or changes that you want to implement. This is especially helpful when working in teams, so you know exactly who was working on what, and makes merges easier!

Pull Requests are basically merges that you are forced to do in order to pull back branches into main. You could do this in the terminal, or just on the GitHub website, and I suggest that you do it on the website instead since it's easier to see and approve any changes!

no screenshots here because no time but just ask me!

PreviousGit Branching & PRsNextMod 1 - JavaScriptFundamentals

Last updated 8 months ago