GIT state diag.txt 1.64 KB
@startuml

'Version: 28/01/20'

title __GIT VARIOUS STATES__

/'
state "**CREATED** (créé)" as WD
'/


/' ALL STATES '/

1_WORK_DIR: Brouillon \n("git diff <file>" to see last changes made)\n("git clean" to delete last changes)

STASHED: Put in a temporary place \n("git stash list" to see content)\n("git stash show" to show changes from latest stash entry)\n("git stash drop" to show changes from latest stash entry)\n("git stash branch {BRANCH NAME}" creates a branch, starting from the HEAD at the moment you've stashed the changes, and applies the stashed changes to that branch)

2_STAGED: Ready to be commited\n("git diff --staged" to see last changes made and added)

3_LOCAL_REP: Local Repository (my device)\n("git log [-- graph]" to see all commits)\n("git diff HEAD^!" to see last commit changes)\n("git diff <commit-num>^!" to see changes introduced by commit-num)\n("git diff commit-num-from commit-num-to" to see changes between commit-num-from and commit-num-to)

4_REMOTE_REP: Remote Repository (a distant server...)




[*] --> 1_WORK_DIR : git clone (or git init) 

1_WORK_DIR -r-> STASHED : git **stash [push | save] [<stash_name>]**
STASHED -l-> 1_WORK_DIR : git **stash pop | apply**

1_WORK_DIR -d-> 2_STAGED : git **add** (file | .)
2_STAGED -l-> 1_WORK_DIR : git **checkout** -- (file | '*.py')
2_STAGED --> 1_WORK_DIR : git **reset** [--hard] [HEAD <file>]

2_STAGED --> 3_LOCAL_REP : git **commit** -m "message" [ file | . ] [origin <branch-name>]
3_LOCAL_REP --> 2_STAGED : git **reset --soft** HEAD^ \n(= commit -1)

3_LOCAL_REP --> 4_REMOTE_REP : git **push** [origin <branch-name>]
4_REMOTE_REP --> 3_LOCAL_REP : WHICH COMMAND ???


@enduml