What is Git?
It is a version control system.
For example, if you are writing a article, you update it regularly with non-trival modification, when you save your file, you don’t want to overwrite it just in case you might change your mind and go back to previous version. Instead of creating many files names ended with v1, v2, v3… you find a software to record the changes.
Git is a software recording all the changes your team-member and you make.
How to use Git?
We use command line to setup a Git repository and record different changes. There are also visual tools to interact with Git repo, but command line is neat. Several important commands are listed below.
git init — create/setup repo locally
git clone— copy repo remotely
git add — add new changes, which means staging the changes
git commit — confirm the staged changes, create a snapshot
git push — push the committed changes to remote repo
git pull — pull new changes from repo, align with new versions of the codes
git merge — merge different version of the same file
git status — check the current modification, stage, commit information
git remote — check remote repo information
git branch — check, create branches
git reset — reset to status before staging, soft reset to staged period
GitHub Flow
GitHub is a hosting service, the local repositories got to be hosted here allowing cooperation among developers.
A typical working flow is introduced in this interactive tutorial: https://guides.github.com/introduction/flow/
which covers the steps from create new branches, making changes and commit, open a pull request in order to merge the changes to master branch, discussion on the new changes and deploy to test, finally commit and merge to the master.