git[編輯]
維基百科,自由的百科全書
gitweb,git的一個Web界面。
穩定版本
2.10.2[1]
(2016年10月28日,?27天前)
預覽版本
2.10.0-rc2[2]
(2016年8月26日,?2個月前)
類型
版本控制
許可協議
GNU通用公共許可證 第二版,GNU寬通用公共許可證 2.1版[4]
)是一個分布式版本控制軟件,最初由林納斯·托瓦茲(Linus Torvalds)創作,于2005年以GPL發布。最初目的是為更好地管理Linux內核開發而設計。應注意的是,這與GNU Interactive Tools[6]
(一個類似Norton Commander界面的文件管理器)有所不同。
git最初的開發動力來自于BitKeeper和Monotone[7]
[8]
。git最初只是作為一個可以被其他前端(比如Cogito或Stgit[9]
)包裝的后端而開發的,但后來git內核已經成熟到可以獨立地用作版本控制[10]
。很多著名的軟件都使用git進行版本控制[11]
,其中包括Linux內核、X.Org服務器和OLPC內核等項目的開發流程[12]
。
3主要功能
4實現原理
5庫結構
6移植性
7Git 指令參考7.1安裝和配置
7.2獲取和創建項目
7.3基本快照服務
7.4分支與合并
7.5共享和更新項目
7.6檢查和比較
7.7修補
7.8調試
7.9電子郵件
7.10外部系統
7.11管理
7.12服務器管理
7.13管道指令
8使用8.1使用git的項目
8.2支持git的源碼訪問服務
命名來源[編輯]
林納斯·托瓦茲自嘲地取了這個名字“git”,該詞源自英國俚語,意思大約是“混賬”。[13]
[14]
“
I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.
”
git的官方wiki也給出了多種關于這個名字的解釋。[15]
歷史[編輯]
自2002年開始,林納斯·托瓦茲決定使用BitKeeper作為Linux內核主要的版本控制系統用以維護代碼。因為BitKeeper為專有軟件,這個決定在社區中長期遭受質疑。在Linux社區中,特別是理查德·斯托曼與自由軟件基金會的成員,主張應該使用開放源代碼的軟件來作為Linux核心的版本控制系統。林納斯·托瓦茲曾考慮過采用現成軟件作為版本控制系統(例如Monotone),但這些軟件都存在一些問題,特別是性能不佳。現成的方案,如CVS的架構,受到林納斯·托瓦茲的批評[16]
。
2005年,安德魯·垂鳩寫了一個簡單程序,可以連接BitKeeper的存儲庫,BitKeeper著作權擁有者拉里·麥沃伊認為安德魯·垂鳩對BitKeeper內部使用的協議進行逆向工程,決定收回無償使用BitKeeper的授權。Linux內核開發團隊與BitMover公司進行蹉商,但無法解決他們之間的歧見。林納斯·托瓦茲決定自行開發版本控制系統替代BitKeeper,以十天的時間,編寫出第一個git版本[17]
[18]
。
版本[編輯]
版本
原始發行日期
最新版本
發行日期
0.99
2005-07-11
0.99.9n
2005-12-15
1.0
2005-12-21
1.0.13
2006-01-27
1.1
2006-01-08
1.1.6
2006-01-30
1.2
2006-02-12
1.2.6
2006-04-08
1.3
2006-04-18
1.3.3
2006-05-16
1.4
2006-06-10
1.4.4.5
2008-07-16
1.5
2007-02-14
1.5.6.6
2008-12-17
1.6
2008-08-17
1.6.6.3
2010-12-15
1.7
2010-02-13
1.7.12.4
2012-10-17
1.8
2012-10-21
1.8.5.6
2014-12-17
1.9
2014-02-14
1.9.5
2014-12-17
2.0
2014-05-28
2.0.5
2014-12-17
2.1
2014-08-16
2.1.4
2014-12-17
2.2
2014-11-26
2.2.3
2015-09-04
2.3
2015-02-05
2.3.10
2015-09-29
2.4
2015-04-30
2.4.11
2016-03-17
2.5
2015-07-27
2.5.5
2016-03-17
2.6
2015-09-28
2.6.6
2016-03-17
2.7
2015-10-04
2.7.4
2016-03-17
2.8
2016-03-28
2.8.4
2016-06-06
2.9
2016-06-13
2.9.3
2016-08-12
2.10
2016-09-02
2.10
2016-09-02
格式:
舊版本
舊版本,仍被支持
當前版本
最新的預覽版
主要功能[編輯]
git是用于Linux內核開發的版本控制工具。與CVS、Subversion一類的集中式版本控制工具不同,它采用了分布式版本庫的作法,不需要服務器端軟件,就可以運作版本控制,使得源代碼的發布和交流極其方便。git的速度很快,這對于諸如Linux內核這樣的大項目來說自然很重要。git最為出色的是它的合并追蹤(merge tracing)能力。
實際上內核開發團隊決定開始開發和使用git來作為內核開發的版本控制系統的時候,世界上開源社區的反對聲音不少,最大的理由是git太艱澀難懂,從git的內部工作機制來說,的確是這樣。但是隨著開發的深入,git的正常使用都由一些友善的命令稿來執行,使git變得非常好用。現在,越來越多的著名項目采用git來管理項目開發,例如:wine、U-boot等[19]
。
作為開源自由原教旨主義項目,git沒有對版本庫的瀏覽和修改做任何的權限限制,通過其他工具也可以達到有限的權限控制,比如:gitosis、CodeBeamer MR。原本git的使用范圍只適用于Linux/Unix平臺,但在Windows平臺下的使用也日漸成熟,這主要歸功于Cygwin、msysgit環境,以及TortoiseGit這樣易用的GUI工具。git的源代碼中也已經加入了對Cygwin與MinGW編譯環境的支持且逐漸完善,為Windows用戶帶來福音。
實現原理[編輯]
git和其他版本控制系統(如CVS)有不少的差別,git本身關心文件的整體性是否有改變,但多數的CVS或Subversion系統則在乎文件內容的差異。因此git更像一個文件系統,直接在本機上獲取數據,不必連接到主機端獲取數據。
庫結構[編輯]
hooks:存儲鉤子的文件夾
logs:存儲日志的文件夾
refs:存儲指向各個分支的指針(SHA-1標識)文件
objects:存放git對象
config:存放各種設置文檔
HEAD:指向當前所在分支的指針文件路徑,一般指向refs下的某文件
移植性[編輯]
在Windows平臺上有msysgit與TortoiseGit可資利用。TortoiseGit還提供有GUI。
現在git也提供windows版本下載。http://git-scm.com/download
Git 指令參考[編輯]
安裝和配置[編輯]
config
help
獲取和創建項目[編輯]
init
clone
基本快照服務[編輯]
add
status
diff
commit
reset
rm
mv
分支與合并[編輯]
branch
checkout
merge
mergetool
log
stash
tag
共享和更新項目[編輯]
fetch
pull
push
remote
submodule
檢查和比較[編輯]
show
log
diff
shortlog
describe
修補[編輯]
bisect
blame
grep
調試[編輯]
bisect
blame
grep
電子郵件[編輯]
am
apply
format-patch
send-email
request-pull
外部系統[編輯]
svn
fast-import
管理[編輯]
clean
gc
fsck
reflog
filter-branch
instaweb
archive
bundle
服務器管理[編輯]
daemon
update-server-info
管道指令[編輯]
cat-file
commit-tree
count-objects
diff-index
for-each-ref
hash-object
ls-files
merge-base
read-tree
rev-list
rev-parse
show-ref
symbolic-ref
update-index
update-ref
verify-pack
write-tree
使用[編輯]
使用git的項目[編輯]
有不少的項目目前都使用git:[20]
Arch Linux
Aquamacs Emacs
BlueZ[23]
Laika (EHR testing framework)[39]
LilyPond (music typesetting)[40]
LMMS Music Production Software [42]
One Laptop Per Child (OLPC)[47]
支持git的源碼訪問服務[編輯]
以下是部分知名的支持git的源碼訪問服務:
BerliOS
Beanstalk
Bitbucket
CodePlex
GitHub
gitorious
GNU Savannah
Google Code
JavaForge
Pikacode
SourceForge
git @ OSC
CSDN CODE
Coding
gitlab
參考文獻[編輯]
^ Hamano, Junio. git v2.10.2 Release Notes. kernel. 2016-10-28 [2016-10-28].
^ Junio C Hamano. git v2.10.0-rc2. [2016-08-26].
^ http://git.kernel.org/?p=git/git.git;a=tree
^ git's LGPL license at github.com. github.com. 20 May 2011 [12 October 2014].
^ git - Definition and pronunciation. Oxford Learner's Dictionaries.
^ [1]
^ Linus Torvalds. [Re: ANNOUNCE git wiki]. linux-kernel. 2006-05-05. "Some historical background" on git's predecessors
^ Linus Torvalds. Re: Kernel SCM saga. linux-kernel. 2005-04-07.
^ Linus Torvalds. Re: Kernel SCM saga. linux-kernel. 2005-04-08 [2008-02-20].
^ Linus Torvalds. Re: Errors gittifying GCC and Binutils. git. 2006-03-23.
^ Projects that use git for their source code management. [2008-02-20].
^ OLPC wiki. Project hosting. [2008-02-20].
^ “a person, especially a man, who is stupid or unpleasant”(愚蠢或令人不爽的人,尤指男人)[2]
^ After controversy, Torvalds begins work on git. InfoWorld. 2005-04-19 [2008-02-20]. ISSN 0199-6649.
^ gitFaq: Why the 'git' name?
^ LinusTalk200705Transcript
^ Linux-Kernel Archive: Kernel SCM saga
^ 王立恒. Git十歲了!Git之父Linus Torvalds說古,大談Git開發秘辛. iThome. 2015-04-10 [2016-05-10].
^ [3]
^ Projects that use git for their source code management. [2008-02-20].
^ Getting Started/Sources/Amarok git Tutorial - KDE TechBase
^ Using Repo and git (Android Open Source Project)
^ BlueZ ? git access
^ Btrfs source repositories - btrfs Wiki. Btrfs.wiki.kernel.org. [2009-06-15].
^ git.debian.org git
^ digg.git - part 1 | Digg About
^ TypicalgitUsage - dragonflywiki
^ [4]
^ Download
^ Get FFmpeg. Ffmpeg.org. [2009-06-15].
^ git - Fast Version Control System. [2010-04-24].
^ Lucas Rocha. Mailing List Announcement. [2009-03-19]. GNOME to migrate to git version control system...
^ git - GNOME Live!
^ gstreamer Wiki - gitDeveloperGuidelines
^ gthumb - GNOME Live!
^ GTK+ - Download
^ source repositories
^ Downloading jQuery - jQuery JavaScript Library
^ CCHIT's laika at master - gitHub
^ LilyPond, music notation for everyone
^ The Linux Mint Blog ? Blog Archive ? Mint to use Launchpad for translations, bugs, blueprints and github for code hosting and version control
^ LMMS - Linux MultiMedia Studio
^ Maemo - gitorious
^ MeeGo - gitorious
^ Ruby on Rails: Merb
^ MooTools - a compact javascript framework
^ OLPC wiki. Project hosting. [2008-02-20].
^ openSUSE - gitorious (英語).
^ Léon Brocard. Mailing List Announcement. [2008-12-22]. The Perl Foundation has migrated Perl 5 to the git version control system...
^ PHP. PHP migrates to git. PHP Group. 2012-03-20 [2012-03-20].
^ phpBB. phpBB moves source code versioning from Subversion to git. phpBB Group. 2010-03-07 [2010-03-07].
^ Prototype JavaScript framework: Contribute
^ Qt now open for community contributions. 2009-05-11 [2009-06-22].
^ Reddit Goes Open Source. [2010-02-26].
^ "Rails is moving from SVN to git". [2008-04-03].
^ Using git for Samba Development - SambaWiki
^ SproutCore Documentation
^ Sugar Labs project hosting
^ Accessing SWI-Prolog source via <a href="http://git-scm.com/">git</a>
^ 60.0
60.1
git - VideoLAN Wiki
^ gitWine - The Official Wine Wiki
^ Xiph git
^ X.Org Wiki - Development/git
^ YUI 2 and YUI 3 Source Code Now on gitHub. [2009-01-20].
外部鏈接[編輯]
git官方網站(英文)
git快速入門(英文)
git Man Page(英文)
git用戶手冊(英文)
git Community Book(英文)
使用git管理源代碼
git# (gitSharp)(英文)
GNU Interactive Tools
git從入門到精通P
連猴子都能懂的Git入門指南(繁體中文)
參見[編輯]
計算機程序設計主題
自由軟件主題