Git Cheat Sheet

Initialise a folder locally to be source control repo
Add changed files to be staged ready for a commit ("." represents all files down from the current )
Commit changes
Create a repo in github
Diagrams to follow.
attach a local repo to an empty repo in github
Diagrams to follow these commands usually pop out of github -
1git remote add origin git@github.com:r3adm3/mytestrepo.git
2git branch -M main
3git push -u origin main
bash
clone a repo in github
TBD picture to go here
1#only needed if a generic source folder doesn't exist
2mkdir Source
3cd Source
4mkdir github
5cd github
6
7#the actual command needed
8git clone git@github.com:r3adm3/mytestrepo.git
bash
check what remote repo a local git repo is attached to.
push changes to github
Create a branch
Create and switch to branch
Switch to branch
list branches
Pull requests and merges
TBD, diagrams to be added.
.gitconfig handy alias
1#stored in /home/username or c:\users\username
2
3[user]
4 name = FirstName LastName
5 email = emailaddress@emailprovider.com
6
7[alias]
8 lg = log --graph --pretty=format:'%C(green)%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative
bash
use the alias to show you a list of all code commits and branches lifecycle