<-Back

Connor's Cool AF Git Cheat Sheet


Usefull windows commands

Command Syntax Function
mkdir [NAME] [NAME]: Name of a folder in "quotations" Creates a new folder called [NAME]
cd [NAME] [NAME]: Name of a folder in "quotations" Changes directory (moves into) folder called [NAME]
dir /b : optional parameter, use for simpler display Displays all the files and directories in your current directory

One-time setup for Git

Make sure you make a GitHub account first!

Command Syntax Function
winget install --id Git.Git -e --source winget none Installs Git on windows. Visit Git's website for other OS's
git config --global user.name [USER] [USER] : Your GitHub username Tells Git you're allowed to push and pull from a repo
git config --global user.email [EMAIL] [EMAIL] : Your GitHub email Tells git you're allowed to push and pull from a repo (Again)

Working with a repository (repo)

Command Syntax Function
git clone [URL] [URL] : A GitHub repo link Clones [URL] to the current directory
git pull none Pulls the latest updates from the main branch
git pull origin [NAME] [NAME] : Name of a branch in the repo Pulls the latest updates from the named branch
git branch [NAME] [NAME] : Name of a branch Makes a new branch with a name. Branch will go to GitHub on push
git checkout [NAME] [NAME] : Name of a branch Changes working branch to the named branch
git branch none Lists the local branches
git push origin --delete [NAME] [NAME] : The name of a branch Deletes the named branch
git add . none Tells Git which files you have changed
git status none Tells you which files you told Git you have changed
git commit -m [MESSAGE] [MESSAGE] : A short message to others saying what you changed Commits latest changes to Git
git push none Pushes latest commit to GitHub

Ideal Git Workflow

  1. git pull
  2. git branch [YOUR NAME/PROJECT]
  3. git checkout [BRANCH FROM 2]
  4. Make changes
  5. git commit to your branch regularly
  6. git pull from your branch regularly
  7. When your done, submit a pull request in GitHub
  8. Delete your branch

Communicate with your team!


<-Back