
1. A distributed version control system
2. Everything in Git is checksummed before it is stored
2.1. And referred to by that checksum.
2.2. SHA-1 hash is the mechanism used for checksumming
2.2.1. 40 char string made of hex chars.
3. 3 States
3.1. 3 main states that files can reside
3.2. modified
3.2.1. changed the file, but not committed
3.3. staged
3.3.1. marked a modified file in it's current version to go into next commit snapshot
3.4. committed
3.4.1. data is stored in the local database
4. 3 Sections
4.1. 3 main sections of any Git project
4.2. Working directory
4.2.1. single checkout of one version of the project
4.3. Staging area
4.3.1. A simple file
4.3.2. generally inside Git directory
4.3.3. Stores information about what will go into your next commit
4.4. Git directory
4.4.1. Git stores meta data and object database for the project
5. Workflow
5.1. 1. Modify files in working directory
5.2. 2. Stage the files, adding snapshots of them to your staging area
5.3. 3. Do a commit - which takes the files as they are in staging area and stores that snapshot permanently in Git directory
6. First time Git Setup
6.1. Git comes with a tool called 'git config'
6.1.1. lets you set configuration variables
6.2. The config vars are stored in 3 different places
6.2.1. /etc/gitconfig
6.2.1.1. contains values for every user on the system and their respos
6.2.1.2. to read/write from this file
6.2.1.2.1. use 'git config --system ....'
6.2.2. ~/.gitconfig
6.2.2.1. specific to user
6.2.2.2. to read/write to this file
6.2.2.2.1. use 'git config --global ...'
6.2.3. .git/config
6.2.3.1. specific to single respository
7. Commands
7.1. git config --list
7.2. Getting help
7.2.1. git help <verb>
8. Setting up a Repository
8.1. Add a project to a Git repo
8.1.1. initializing a repo in existing folder
8.1.1.1. $git init
8.1.1.1.1. creates a.git directory
8.1.1.1.2. nothing is tracked yet (until the first commit)
8.1.1.2. Adding files to git
8.1.1.2.1. $git add *.c
8.1.1.2.2. $git add README
8.1.1.2.3. $git commit -m 'initial project version'
8.2. Clone an existing Git repo(from other server)
8.2.1. $git clone git://github.com/akbar/proj.git
8.2.1.1. creates a directory /proj
8.2.1.2. Also checks out a working copy
9. 2 stages
9.1. tracked
9.1.1. are files that were from last snapshot
9.2. un-tracked
10. Checking the Status of files
10.1. $git status
10.2. tracking new files
10.2.1. $git add FILENAME
10.3. staging changed files
10.4. Viewing staged and unstaged changes
10.4.1. $git status is too vague
10.4.2. use $git diff
10.4.3. To see whats changed but not staged
10.4.3.1. use $git diff
10.4.4. To see whats staged and going into commit
10.4.4.1. use $git diff --cached
10.4.4.2. or use (>1.6.1) $git diff --staged
11. Ignoring Files
11.1. files you don't want to add
11.2. or show as being untracked
11.3. .gitignore file
11.3.1. blank lines are ignored
11.3.2. lines with # are ignored
11.3.3. standard glob patterns work
11.3.4. patterns ending with / indicate folder
11.3.5. ! - to negate a pattern
12. Committing your changes
12.1. $git commit
12.2. Skipping staging area
12.2.1. $git commit -a
12.3. Removing files
12.3.1. $git rm FILENAME
12.3.1.1. removes it from Stage and working copy
12.3.2. $rm FILENAME
12.3.2.1. removes it in working dirctory
12.3.2.2. needs to be staged and committed
12.3.3. a scenario
12.3.3.1. If you make changes to a file and don't stage and want to delete
12.3.3.1.1. use $git rm FILENAME -f
12.3.4. Removing it only from stage
12.3.4.1. $git rm --cached FILENAME
12.4. Moving files
12.4.1. Git doesn't track file movement
12.4.2. If you rename a file
12.4.2.1. no meta data is stored in Git to capture that
12.4.3. command
12.4.3.1. $git mv file_from file_to
13. Viewing commit history
13.1. $git log
14. Undoing things
14.1. changing your last commit
14.1.1. $git commit --amend
14.1.2. takes staging area and used for commit
14.1.3. snapshot will look exactly the same
14.2. unstaging a staged file
14.2.1. $git reset HEAD filename
14.3. Unmodifying a modified file
14.3.1. $git checkout -- filename
14.3.2. be careful - you modified working copy changes would be lost
15. Remote repositories
15.1. checking the remote for existing repo
15.1.1. $git remote -v
15.2. adding remote repos
15.2.1. $git remote add [shortname] [url of repo]
15.2.2. This gives a right to fetch the git repo into local repo
15.2.3. Ex: $git remote add pb git://github.com/akbar/myproj.git
15.2.3.1. $git fetch pb
15.3. Fetching and Pulling from remotes
15.3.1. $git fetch [remote-name]
15.3.2. fetch only pulls data to local repo - doesn't merge with working directory
15.3.3. $git pull
15.3.3.1. pull fetches the data and merges with working copy/branch
15.4. Pushing to remotes
15.4.1. $git push [remote-name] [branch-name]
15.5. Inspecting remotes
15.5.1. $git remote show [remote-name]
15.6. Removing and renaming remotes
15.6.1. $git remote renamte [old] [new]
15.6.2. $git remote rm [remote-name]
16. Tagging
16.1. Listing your tags
16.1.1. $git tag
16.1.2. $git tag -l v1.4.2 (searches)
16.2. Creating Tags
16.2.1. 2 types of tags
16.2.1.1. lightweight
16.2.1.1.1. like a branch that doesn't change
16.2.1.1.2. a pointer to a specific commit
16.2.1.2. annotated
16.2.1.2.1. stored as full objects in Git database
16.2.1.2.2. check-summed
16.2.1.2.3. contains tagger name
16.2.1.2.4. email
16.2.1.2.5. date
16.2.1.2.6. have a tagging message
16.2.1.2.7. can be signed with GPG
16.2.1.2.8. creating