- Committed: Data is safely stored in your local db
- Modified: Data changed but not committed to db yet
- Staged: Changed data marked to go in next commit snapshot
- Checkout: Git Dir (repo) to Working Dir
- Stage: Working Dir to Staging Area
- Commit: Staging Area to Git Dir (repo)
- Git directory: Storage of metadata and object db
- Working directory: single checkout of one version of the project
- Staging Area: Single file with next commit info
-
Modify files in Working Dir
-
Stage the files, adding snapshots to Staging Area
-
Commit, takes files in the staging area and stores that snapshot in Git Dir
[Working Dir] -> Staging -> [Staging Area] -> Commit -> [Git Dir]
- Tracked: included in last snapshot
- Unmodified
- Modified
- Staged
- Untracked: not included in last snapshot nor in Staging Area
git clone [email protected]:omarrr/5nbox.git
Stage changed files
git add FILE
Revert add
git reset FILE
Commit stage
git commit -m "fixed XYZ"
Automatically stages every file that's already tracked, then commits
git commit -a
Probably shouldn't get into the habit of doing this...
To repo 'origin' the branch 'master'
git push origin master
git branch
git branch -all
Create
git branch hotfix
Switch
git checkout hotfix
Create + Switch
git checkout -b hotfix
Checkout destination branch
git checkout master
Merge
git merge hotfix
Open Merge Tool
git mergetool -t opendiff
git branch -d hotfix
fetch + merge = pull