有些內容使用中英雙語,有些只有英文或中文。歡迎使用與分享任何內容,但先來信告知並標示此部落格為出處。
Some parts use both Chinese and English, but some parts use only one language. Feel free to share, but please contact me first and list this blog as your reference.

2014年8月8日 星期五

Coursera 上課筆記 - The Data Scientist’s Toolbox - 第二週 Git Command

Course note for  The Data Scientist’s Toolbox - Git Command
這是  The Data Scientist’s Toolbox 第二週的筆記之一

延伸閱讀:The Data Scientist’s Toolbox 上課心得

只是快速做個小記錄!for my future reference.


git init   #初始化

git config --global user.name "name"
git config --global user.email "name@mail.com"
git config --list

git add .  adds all new files
git add -u tracking for changed names/deleted files
git add -A do both above

git commit -m "message"

git push orgin master

git checkout -b branchname  #create a branch
git branch             #see what branch
git checkout master           #switch to master branch

git remote add origin https://github.com/autekroy/datasciencecoursera.git
git remote -v                  #check remote 狀態
git remote rm  [name]     #ex: git remote rm origin 刪除remote


git fetch origin 把新的改變存到local repo (非工作空間)

git merge origin/master
# Merges updates made online with your local work
# Merging combines your local changes with changes made by others.
# Typically, you'd merge a remote-tracking branch with your local branch:


pull = Fetch + merge
pull : merge in your changes into the orignal repo/branch

# 初始化後,要先pull下來, -> git pull origin master
# 這樣同步才會差不多,等於 Fetch + merge


fork 檔案,先在github上面案fork
在work place 用 : git clone URL.git
會自動創造一個origin的remote
再做一個remote upstream
git remote add upstream 原使的URL(fork的位置)
git fetch upstream 回到自己的local repo





If you want to use (copy, paste or quote) my original article, please contact me through email. (autek.roy@gmail.com) If there is any mistake or comment, please let me know. :D

如要使用(複製貼上或轉載)作者原創文章, 請來信跟我聯絡。(autek.roy@gmail.com) 如果有發現任何的錯誤與建議請留言或跟我連絡。 : )

沒有留言:

張貼留言

請留下您的任何想法或建議!
Please leave any thought or comment!