30
優雅的在 Emacs 使 git Cosucp 2013 Superbil (鄭開元)

優雅的在 Emacs 中使用 git

Embed Size (px)

Citation preview

Page 1: 優雅的在 Emacs 中使用 git

優雅的在 Emacs 中使⽤用 git

Cosucp 2013Superbil (鄭開元)

Page 2: 優雅的在 Emacs 中使用 git

About Me•軟體⼯工程師、iOS 開發

•Emacs 使⽤用經驗⼤大約 1 年

•Git 使⽤用經驗⼤大約 4 年

•PyHUG 主持⼈人

•about.me/superbil

• freenode #emacs.tw #g0v.tw #python.tw on ircCloud

Page 3: 優雅的在 Emacs 中使用 git

Outline

• What is Emacs ?

• What is Git ?

• Magit

• Live Demo

Page 4: 優雅的在 Emacs 中使用 git

什麼是 Emacs ?

Page 5: 優雅的在 Emacs 中使用 git

編輯器

Page 6: 優雅的在 Emacs 中使用 git

Why I use Emacs?

• Magit

• Org-mode

• eshell

• ansi-termrun zshell

Page 7: 優雅的在 Emacs 中使用 git

Emacs 基本介紹

• Ctrl + h t // emacs tutorial

• Ctrl + {b,n,p,f} // h j k l

• Ctrl + x b // 切換 buffer

• Ctrl + x Ctrl + e // 執⾏行 ( ) 中的 elisp

• Ctrl + h m // 查詢當下 mode 的⽂文件

Page 8: 優雅的在 Emacs 中使用 git

Emacs 的熱鍵很難按

Page 9: 優雅的在 Emacs 中使用 git

更換你的 Ctrl 鍵位置

• Caps Lock 其實⼀一點都不重要

• Ctrl 在下⾯面的位置其實是⾮非常難按的

巨⼈人出現了阿!!!

Page 10: 優雅的在 Emacs 中使用 git

Emacs in better than X !

政治正確

Page 11: 優雅的在 Emacs 中使用 git

為何不同時使⽤用Emacs 和 Vim ?

by 程序员时髦值指南

同时⽤用 Vim 和 Emacs,这⼈人早被烧死了

Page 12: 優雅的在 Emacs 中使用 git

什麼是

Page 13: 優雅的在 Emacs 中使用 git

什麼是 Git ?

• Git 是版本控管系統

• 管理程式碼、⽂文件資源、法規(?)

• Git 是分散式的,內容都在本地端

• Git 很快

Page 14: 優雅的在 Emacs 中使用 git

Git 更新流程

Page 15: 優雅的在 Emacs 中使用 git

base command for git• status

顯⽰示狀態

• push

把本地推去雲端

• pull

抓雲端資料下來

• add

新增檔案到 stash

• commit把⺫⽬目前狀態寫⼊入log

• log

歷史記錄

• rebase

重寫歷史記錄

Page 16: 優雅的在 Emacs 中使用 git

新增到 staging area 時,選擇要的區塊

可以以⾏行為單位,⽽而不是以檔案每⼀一次的 commit log 更加乾淨

git add --patch

Page 17: 優雅的在 Emacs 中使用 git

Magitbest way use git in Emacs

Page 18: 優雅的在 Emacs 中使用 git

What is Magit ?

• git GUI on Emacs

• that's is very good for keyboard fans

Page 19: 優雅的在 Emacs 中使用 git

Different with vc

• VC

• 使⽤用相同的熱鍵和使⽤用 SCMgit, svn, etc...

• Magit

• 從 Git 的⾏行為來提供使⽤用者介⾯面

Page 20: 優雅的在 Emacs 中使用 git

Magit 介⾯面簡介

Page 21: 優雅的在 Emacs 中使用 git

Show Sections

Page 22: 優雅的在 Emacs 中使用 git

Magit commit 介⾯面

Page 23: 優雅的在 Emacs 中使用 git

History

Page 24: 優雅的在 Emacs 中使用 git

Write changelog

Page 25: 優雅的在 Emacs 中使用 git

Live Demo

Page 26: 優雅的在 Emacs 中使用 git

Oops... Magit 沒⽀支援的功能

• M-x magit-git-command

• hotkey is ‘:’ <your action>

• this will run `git --no-pager <your action>`

Page 27: 優雅的在 Emacs 中使用 git

Some useful mode

• org-magitlink to magit-statususe '~/project/kuansim/::status'

Page 28: 優雅的在 Emacs 中使用 git

Q & A

Page 30: 優雅的在 Emacs 中使用 git

Thank you