minte9
LearnRemember



States

Git has three main states that your files can reside in.
 
#!/bin/sh

: "Git has three main states that your files can reside in:

Working tree    | File changed but not committed it to database yet
Staging area    | File marked as modified to go into your next commit
Repository      | Committed file is stored in your DB

The history of the project is on the local disk
GIT stores everything in his database using hashes
"

alias gs="git status | sed 's/^/\t/' ; echo"
alias gsp="git status --porcelain | sed 's/^/\t/' ; echo"

touch myfile.tmp
    echo "touch"
    echo "Working Tree:"; gsp  

git add .                       
    echo "git add"
    echo "Staging Area:"; gsp

git commit -qm "m"
    echo "git commit"
    echo "Repository:"; gs

git rm -q myfile.tmp 
    echo "git rm"
    echo "Staging Area:"; gsp

git commit -qm "m" 
    echo "git commit"
    echo "Repository:"; gs
 
touch
Working Tree:
    ?? main/basics/states/myfile.tmp

git add
Staging Area:
    A  main/basics/states/myfile.tmp

git commit
Repository:
    On branch main
    nothing to commit, working tree clean

git rm
Staging Area:
    D  main/basics/states/myfile.tmp

git commit
Repository:
    On branch main
    nothing to commit, working tree clean



  Last update: 210 days ago