Configurate Git locally and follow git workflow
- Configure your git locally (本地电脑设置 git)
    
- reference getting started first time git setup
 
 - Clone down the repo to local (复制github repo到本地)
    
- 
        
git clone <your_github_repo_url> 
 - 
        
 - Git flow that helps you to be productive (Git flow 习惯)
    
- Always create and checkout a new branch against master branch when you want to work on something (每一个feature 开一个 分支, 分支最好建立在 master 主分支上)
        
git checkout master // 交换到 本地主分支 git pull //在 本地 主分支上 sync GitHub 主分支 的进度 //(这样 本地 主分支 就会有 GitHub 主分支 的最新更新) git branch <your_new_branch_name> // 在本地 创建一个分支 (git checkout -b <your_new_branch_name>) //这个跟前面的command一样, 也是创建一个本地分支 - Save changes often, and especially if you want to checkout some other branches (保存进度, 特别如果你要交换到其他分支)
        
git add <your_file> (git add . //如果要 git add 所有的file就用 git add .) git commit // 保存进度 
 - Always create and checkout a new branch against master branch when you want to work on something (每一个feature 开一个 分支, 分支最好建立在 master 主分支上)
        
 - Handy git command to help with git work flow
    
- To see current branch (目前分支)
        
git branch - To create new branch (创建分支)
        
git checkout -b <new_branch> //创建并交换到新的分支 - To see files been changed in current branch (查看变动的文件)
        
git status git diff - To add file change to git (保存进度)
        
git add <file_name> (git add .) git commit - To push the local change up to GitHub (把本地进度保存到 GitHub上)
        
git push - To pull down the latest GitHub update (把GitHub上最新进度 sync 下来)
        
git fetch git pull - To stash some local changes
        
git stash - To merge master branch change to your current branch (把主分支的变化加到你的 分支)
        
git add . git commit //(保存进度) git checkout master git pull //(交换到 主分支, 并sync GitHub 主分支的 update) git checkout <your_working_branch> git merge master (git rebase master) //(把主分支的变化加到你的 分支) 
 - To see current branch (目前分支)
        
 - Additional Command
    
- reference git cheat sheet
 
 
    Written on September 22, 2018