Git Mindset
When Git manages a project, files flow through three working areas: the git working directory, the staging area, and the local repository.

Git and GitHub
Git: a source code version control tool GitHub: a remote code hosting repository
First Run of Git
Set your user name and email:
1 | git config --global user.name 'John Doe' |
You can check the existing configuration with git config --list.
Getting Started with Git
1 | git init # initialize a local repository |
Local and Remote Interaction
1 | git fetch |
Git Branches
Multi-Person Collaboration with Git
- First, try pushing your changes with
git push origin branch-name
- If the push fails, it is because the remote branch is newer than your local one; use
git pullfirst to try merging
- If the merge has conflicts, resolve them and commit locally
- When there are no conflicts (or they are resolved),
git push origin branch-nameagain and it will succeed
A Pretty Useful Alias
1 | git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |
More Git Features
- Tags
- Using
gitignore - Version rollback
- Patching with
git - Hosting your own
gitservice
About Using Markdown
MarkdownsyntaxJust visit the Markdown Wiki — one look at the table and you basically know it.
Using
READMEExample: my vim configuration