2015年3月25日 星期三

常用的git指令 Ubuntu


#安裝git
> sudo apt-get install git

設定git
初始化的git設定
> git config --global user.name "你的英文名字"
> git config --global user.email "你的mail"

double check information
> git config --list
> cat~/.gitconfig

補充:
git status可以用alias方式將其簡化成使用者想變成的模樣
以下是將git status 簡化成 git st
> git config --global alias.st status
> git config --global color.ui true

git流程

修改檔案 -> 加入stage (git add) -> 提交 (git commit) -> (push到github) ->繼續修改檔案

查看目前git狀態
> git status



git add

要加入stage的檔案
> git add 檔名

若是要全部加入可以使用
> git add .

互動模式
> git add -i


git commit

直接輸入以下這一行,會進去編輯模式,第1行是要讓使用者輸入修改的註解
> git commit

若不想直接進去可以用,通常註解都會用英文表示,不曉得中文會不會亂碼
> git commit -m "你想說的註解"

若你輸入錯誤可以用以下指令去修改原本的註解
> git commit --amend

git push (如果你有github)

如果你有github帳號,最後就要push上去
> git push -u origin master




到github網站申請帳號 https://github.com/

設定SSH key https://help.github.com/articles/generating-ssh-keys/

參考:
http://gogojimmy.net/2012/01/17/how-to-use-git-1-git-basic/
https://help.github.com/articles/changing-a-commit-message/

1 則留言:

  1. Best Ways to Get From a Slot Machine To the Casino - KTH
    Here you can learn the ins 성남 출장샵 and 문경 출장샵 outs 아산 출장마사지 of playing slot machines, as well as the many 나주 출장마사지 different ways to 영주 출장마사지 find them. Slot Machines For Your

    回覆刪除