D9 - basic git workflow
-
the basic workflow includes:
- editing the file
- staging the file
- committing the file
-
working area is where changed files are
-
running
git status, the files in the working area are shown as 'untracked files' -
the files here are not tracked or saved to git
-
git addmoves it to the index or the staging area -
this is where git starts tracking and saving changes
-
git commitsends the staged changes to the local repository -
this adds a checkpoint that compiles all the changes
-
git logcan be used to view previous commits -
git diffshows all the differences between a file in the staging area and the edits in the working area -
it can also be used to view differences between two branches
-
git pushpushes the local repository changes to the hosting service -
conversely,
git pullpulls code from the hosting service to the local repository -
to move changes from index to the working area, ie. un-stage changes, use
git rm <filename> --cached -
using
git rm <filename>permanently deletes the changes -
git mv <source> <destination>can be used to move or rename a file