So with Git you have the concept of the local copy and the remote copy. As long as you are making commits and pushing to your remote, it will be backed up on Github (and everyone can follow along). You don't have to push commits in real time throughout the day, you can just do it at the end of the day if you wish. That also gives you the opportunity to look at what you have done for the day and squash several minor commits together (maybe you were trying to figure something out and reverted some code, or you just want to clean it up a bit). You can also edit the commit messages if you wish.
To compare current and previous code, you can do it locally. You are just comparing the currently staged/or unstaged (and uncommitted) code with previous commits... or you can compare your various commits very easily.
$ git diffwill show you the current difference between current local saved code and previous local commits. Your current local code that's saved is also considered "unstaged" and shows up as red files. When you "stage" code to be committed, you've added various files and they turn green. You can also add parts of code changes from one file to be staged (see
$ git add --patch below). You can only "commit" staged code.
$ git log
or
$ git log --onelineWill show you your local commit history
$ git diff 1234567..9876543will compare two commit hashes
It will take some time to get used to all of the commands, and my recommendation is to use the .gitconfig file to add aliases for your most frequently used commands. Here's mine:
[alias]
co = checkout
cp = cherry-pick
br = branch
ci = commit
st = status
unstage = reset HEAD --
last = log -1 HEAD
discard = checkout --
pr = "!f() { git fetch origin pull/$1/head:pr-$1 && git checkout pr-$1; }; f"So instead of
$ git status, it's just
$ git stAnd I'm frequently adding / staging code to be committed with:
$ git add --patch
Which allows you to select or split up bits of code to commit, for example if you'd really like to save your current work as two distinct commits.
$ git pr 123Would fetch and check out PR #123 from the remote repository
$ git add --patch
$ git ci -m "added a new intro screen"
$ git pushIs basically what you'll be doing over and over to add commits and push to your remote repo, likely directly in the master branch if it's just you working on the code.
Another handy thing...
$ git stashWill tuck away your currently unstaged (or even staged) code temporarily to allow you to check out other branches or move around freely.
$git stash --applyWill apply the top-most stashed set of changes to the currently checked out branch, then you can stage it as you see fit or keep adding to it.
Whatever you want to know, just google it with what you think you want to do... and you'll find the answer because there are tons of asked and answered questions for Git/Github out there on Stackoverflow. The Git lingo can be a bit odd at first, but you'll start to understand soon enough.
Have fun