frontsidebus / git-cheat-sheet

because I can never remember these commands!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A lot of these are taken from https://www.freecodecamp.org/news/git-cheat-sheet/ and consolidated in a quick and dirty markdown page.

git-cheat-sheet

because I can never remember these commands!

git configuration commands

list git configuration

git config -l

set up git username, email, etc

git config --global uesr.name "Commander Shepherd"

cache those creds in your local credential store

git config --global credential.helper cache

Repo creation/initialization

initialize a repo

git init

add files to your local repo, so they are ready to commit

git add foo.bar
git add foo*
git add vini.file vidi.file vici.file

check the status of your local working repo ie: "did I commit yet?"

git status

check your commit history

git log -p

Checking out, cloning, committing, and other workflow kinda stuff

clone a repo locally

git clone MY_EXCELLENT_REPO_URL

create a branch and check that branch out locally

git checkout -b  MY_EXCELLENT_BRANCH_NAME_PROBABLY_WITH_A_JIRA_CARD_NAME

make some commits

git commit -am "I made some sweet commits, check out my sick new code, j/k it's probably a commit because I misspelled something tbh"

push those new commits to your working branch

git push

get a specific commit

git show COMMIT_HASH_HERE

Some Oh Shit Buttons

revert a staged commit

git reset HEAD this_file_got_fubarred.code
git reset HEAD -p

fix a recent commit with an ammend

git commit --amend

About

because I can never remember these commands!