Beginners Notes on Git Basics (1)

Resource: Learngitbranching.js.org

Jesse Ruiz (she/they)
2 min readFeb 21, 2022

--

It’s imperative for any and all developers, data scientists and other coders/developers to learn version control systems. Check out this amazing resource, learngitbranching.js.org, on a very overlooked skill. I’ve written up some essential notes using this resource for easy access and reference.

Basic definitions:

GIT COMMIT — records a snapshot of all the tracked files in your directory

  • very lightweight; compressed as a set of changes (”delta”) from one version of the repo to the next
  • E.G. git commit

GIT BRANCH — pointers to a specific commit

  • very lightweight; no storage overhead with making branches
  • E.G. git branch newImage

GIT CHECKOUT — navigate between branches created by git branch

  • E.G. git checkout newImage

GIT SWITCH — new in Git version 2.23 to replace git checkout

  • E.G. git switch newImage

GIT MERGE — combines the work of two different branches together

  • creates a special commit that has two unique parents. Includes all work from parent 1 and parent 2 and the set of all their parents.
  • E.G. git merge bugFix

GIT RESET — reverses changes by moving a branch reference backwards in time to an older commit

  • rewriting history like a commit had never been made
  • E.G. git reset HEAD~1

GIT REVERT — reverses changes and share those reversed changes with others

  • E.G. git revert HEAD

GIT CARROT OPERATOR ^ — move upwards one commit at a time

  • E.G. git checkout HEAD^

GIT TILDER OPERATOR ~ — move upwards n number of times using ~n

  • E.G. git checkout HEAD~4

GIT CHECKOUT -B [branchname] — create a new branch and check it out at the same time

  • E.G. git checkout -b [yourbranchname]

--

--

Jesse Ruiz (she/they)

Data Engineer, Artist, Queer writing about tech and life