Back

Git

https://www.youtube.com/watch?v=mYjZtU1-u9Y

Create an empty directory to hold all projects.
Now create a project

git init <projectname>
- This will create a directory with all the relevant objects inside
- New code now gets created in here

Add files (code) to be tracked

git add .          [add all files]
git add <file>     [add only <file>]

Remove file from being tracked

git rm --cached <file>
-Tracked file are held in staging unless removed

Commit files to repository

git commit -m "<description>"
- Commit files with information to indicate what you committed.

Check status

git status
- [RED]shows untracked modified files
- [GREEN]shows tracked modified files
NOTE: Green files can be committed

Check all commits.

git log
-Shows each commit with the description

Check difference between repository and staging

git diff
- Difference between files in working directory (untracked) and repository.
git diff --cached
- Difference between files in staging (tracked) and repository.