@startuml
map BasicCommands {
 git config --global USER.NAME "Jonas Hellgren" => sets name
 git config --global USER.EMAIL "Jonas Hellgren" => sets email
 git config list => shows config settings
 git help config  => shows help about config
 git init  => creates local repo
 git status  => shows status
 git reset FILE  => removes FILE (with path)) from staging area
 git reset   => removes all files from staging area
 git log   => list commit history
 git clone <url> <where to clone>  => cloning remote repo, <where to clone> can be . (here)
 git remote -v  => info about remote repo, for ex after cloning it
 git diff  => lists file changes
}

map AddAndCommit {
 git add <files>  => add files to staging area
 git commit -m <message>  => create commit from files in staging area (updates repo)
 git commit --amend -m <message>  => update latest commit
}

map PushingChanges {
 git remote add origin <url>>  => defines origin alias
 git pull <repoalias> <branch>  => updates local repo from remote repo/branch
 git push <repoalias> <branch>  => updates remote repo from local repo/branch
}

map Branches {
 git branch => lists local branches
 git branch -a  => lists all branches, also on remote repos
 git branch <name>  => creates branch <name>
 git checkout <name>  => sets branch <name> as actual, head points to this one
 git push <repoalias> <branch>  => updates remote repo according to local repo/branch
 git branch -d <name> => delete local branch <name>
 git push origin --delete <name> => delete branch <name> on remote repo origin
}

map UndoMistakes {
 git checkout <filename>  => restores file
 git cherrypick <hashofcommit>  => copies <hashofcommit> commit to present branch, handy if commited to wrong branch
 git reset --hard <hashofoldcommit>  => "walk back in time", warning files updated
 git clean -df  => remove all untracked files
 git reflog => can be used to restore commits "deleted" by git reset, max up to 30 days
 git revert <hashofcommit> => creates new commits to revert changes of earlier commits
}

map Stash {
 General description => Creates "commits" independent of branch. Handy when e.g. want to switch between branches without commiting
 git stash save "<message>" =>  saves working files in stash que
 git stash list => lists stashes
 git stash apply <iteminstashlist>  => update working files according specific stash
 git stash pop   => update according latest stash, that item disappears from stash list
}

map GitAddVariants {
 General description => Git add can be done in different ways
 git add -A => adds all changes: modified, new and deleted files. Also files above current directory.
 git add -A <folder> => ....in specific folder
 git add  => same as git add -A
 git add -u  => adds only modified and deleted, but not new files.
 git add . => add changes in current folder but not above.
}

map Alias {
 alias loggraph="git log --all --decorate --oneline --graph"  => defines loggraph
}

map Branching {
 fast forward branch => result of merging branches on top of each other
 3 way branch => result of merging branches NOT on top of each other
 git  branch --merged => shows merged/identical branches
 git  merge <name> => merges branch <name> into current branch
 git  branch -d <name>  => deletes branch
}

BasicCommands --[hidden]> AddAndCommit
AddAndCommit --[hidden]> PushingChanges
PushingChanges --[hidden]> Branches
Branches --[hidden]> Stash
Stash --[hidden]> GitAddVariants
GitAddVariants --[hidden]> Branching
Branching --[hidden]> Branching

@enduml