??xml version="1.0" encoding="utf-8" standalone="yes"?>精品久久人人做人人爱,亚洲国产精品免费视频,亚洲精品日韩一http://www.aygfsteel.com/xiaomage234/category/33941.html生命本就是一ơ凄的漂流Q记忆中放不下的Q永q是孩提时代的那一份浪漫与U真Q?/description>zh-cnFri, 11 Aug 2017 10:34:48 GMTFri, 11 Aug 2017 10:34:48 GMT60gerrit - first commithttp://www.aygfsteel.com/xiaomage234/archive/2017/08/11/432734.html马?/dc:creator>马?/author>Fri, 11 Aug 2017 03:23:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2017/08/11/432734.htmlhttp://www.aygfsteel.com/xiaomage234/comments/432734.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2017/08/11/432734.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/432734.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/432734.htmlgerritq是L不要试引入Q它的权限管理,真是复杂极了。对于小型团队,初期q将是个噩梦Q但是对于像OpenStackQ安卓这U大型teamQ又是一把利器?/span>
下面试试了两个用L单情况,很多配置都是pȝ默认Q没有进行啥复杂配置Q即使这样也是错误百出,光一个commitp折腾半天Q而且q有些机制没搞清楚?div>
首先要做的准备工作就是准备两个gerrit用户Quser1和user2Qƈ且分别把user1和user2的ssh pub-key通过gerrit settingd好?/div>
1. 首先user1创徏一个叫HelloWord的project?/div>
   如何创徏project请参考前期博客或者官Ҏ档?/div>
2. user1在自q工作环境中把HelloWord clone下来
[user1@jenkins ~]$ git clone ssh://user1@gerrit.example.com:29418/HelloWorld.git
Initialized empty Git repository in /home/user1/HelloWorld/.git/
remote: Counting objects: 2, done
remote: Finding sources: 100% (2/2)
remote: Total 2 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (2/2), done.
加入user1没有dssh pubkey的话Q这一步会出permission deny

clone后,创徏一个README文gqaddQcommit
[user1@jenkins ~]$ cd HelloWorld
[user1@jenkins HelloWorld]$ ls
[user1@jenkins HelloWorld]$ touch README
[penxiao@jenkins test]$ git add README 
[penxiao@jenkins test]$ git commit -m add README
q里注意一点,在下面要push之前Q一定要配置好git config?username和email
可以通过命o行或者直接编?~/.gitconfig文g实现Q而且email一定要和gerrit里注册的email一_否者push也会出错?br />[user1@jenkins HelloWorld]$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 213 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done    
To ssh://user1@gerrit.example.com:29418/HelloWorld.git
 * [new branch]      master -> master
[user1@jenkins HelloWorld]$

在gerrit的gitweb链接可以查看push的文件?/div>
3. user2加入
[user2@jenkins ~]$ git clone ssh://user1@gerrit.example.com:29418/HelloWorld.git
Initialized empty Git repository in /home/user2/HelloWorld/.git/
remote: Counting objects: 3, done
remote: Finding sources: 100% (3/3)
remote: Total 3 (delta 0), reused 3 (delta 0)
Receiving objects: 100% (3/3), done.
[user2@jenkins ~]$ cd HelloWorld
[user2@jenkins HelloWorld]$ ls
README
[user2@jenkins HelloWorld]$ 
user2对README文gq行修改Q然后要commitQpush
Q!Q也同样注意Quser2的git configQusername和email的配|,email要和gerrit setting里的一致?/div>
commit完以后可以看?/div>
[user2@jenkins HelloWorld]$ git log
commit 7959fe47bc2d2f53539a1861aa6b0d71afe0a531
Author: user2 <user2@gerrit.com>
Date:   Thu Dec 12 00:24:53 2013 -0500
    edit README
commit 98099fc0de3ba889b18cf36f9a5af267b3ddb501
Author: user1 <user@gerrit.com>
Date:   Thu Dec 12 00:15:08 2013 -0500
    add README
[user2@jenkins HelloWorld]$
现在user2要把q次的改变push到gerritQ可以么Q?/div>
不行的,可以看到
[user2@jenkins HelloWorld]$ git push origin master
Counting objects: 5, done.
Writing objects: 100% (3/3), 249 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Branch refs/heads/master:
remote: You are not allowed to perform this operation.
remote: To push into this reference you need 'Push' rights.
remote: User: user2
remote: Please read the documentation and contact an administrator
remote: if you feel the configuration is incorrect
remote: Processing changes: refs: 1, done    
To ssh://user2@gerrit.example.com:29418/HelloWorld.git
 ! [remote rejected] master -> master (prohibited by Gerrit)
error: failed to push some refs to 'ssh://user2@gerrit.example.com:29418/HelloWorld.git'
[user2@jenkins HelloWorld]$ 
q就是gerrit的精髓所在了?span style="word-wrap: normal; word-break: normal; line-height: 21px; background-color: #ffffff;">原因是gerrit不允许直接将本地修改同步到远E仓库。客h必须先push到远E仓库的refs/for/*分支上,{待审核。这也是Z么我们需要用gerrit的原因。gerrit本n是个代码审核工兗?/span>

接下来更该push的地址Q? 
[user2@jenkins HelloWorld]$git config remote.origin.push refs/heads/*:refs/for/*  
此命令实际是更改的是本地仓库test_project/.git/config文g?nbsp;
再次push   
[user2@jenkins HelloWorld]$git push origin  
q次不要加master
[user2@jenkins HelloWorld]$ git push origin
Counting objects: 5, done.
Writing objects: 100% (3/3), 249 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done    
remote: ERROR: missing Change-Id in commit message footer
remote: Suggestion for commit message:
remote: edit README
remote: 
remote: Change-Id: I7959fe47bc2d2f53539a1861aa6b0d71afe0a531
remote: 
remote: Hint: To automatically insert Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 user2@gerrit.example.com:hooks/commit-msg ${gitdir}/hooks/
remote: 
remote: 
To ssh://user2@gerrit.example.com:29418/HelloWorld.git
 ! [remote rejected] master -> refs/for/master (missing Change-Id in commit message footer)
error: failed to push some refs to 'ssh://user2@gerrit.example.com:29418/HelloWorld.git'
玛Q还是不行,说缺change-IdQؓ了能让每ơcommit能自己insert q个change-idQ需要从gerrit server上下载一个脚?/div>
[user2@jenkins HelloWorld] scp -p 29418 user2@gerrit.example.com:hooks/commit-msg <local path to your git>/.git/hooks/
然后重新commit
[user2@jenkins HelloWorld]$ git commit --amend
再次查看git log
[user2@jenkins HelloWorld]$ git log
commit f6b5919170875b5b4870fca2ab906c516c97006e
Author: user2 <user2@gerrit.com>
Date:   Thu Dec 12 00:24:53 2013 -0500
    edit by user2
    
    Change-Id: Ieac68bebefee7c6d4237fa5c058386bf7c4f66b7
commit 98099fc0de3ba889b18cf36f9a5af267b3ddb501
Author: user1 <user1@gerrit.com>
Date:   Thu Dec 12 00:15:08 2013 -0500
    add README
[user2@jenkins HelloWorld]$ 
q次有了change id
然后再次push
[user2@jenkins HelloWorld]$ git push origin
Counting objects: 5, done.
Writing objects: 100% (3/3), 289 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Processing changes: new: 1, refs: 1, done    
remote: 
remote: New Changes:
remote:   http://gerrit.example.com:8080/1
remote: 
To ssh://user2@gerrit.example.com:29418/HelloWorld.git
 * [new branch]      master -> refs/for/master
[user2@jenkins HelloWorld]$ 


]]>常用 Git 命o清单http://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428825.html马?/dc:creator>马?/author>Fri, 25 Dec 2015 05:32:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428825.htmlhttp://www.aygfsteel.com/xiaomage234/comments/428825.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428825.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/428825.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/428825.html阅读全文

]]>
Git、GitHub、GitLab协作程详解【{?/title><link>http://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428819.html</link><dc:creator>马?/dc:creator><author>马?/author><pubDate>Fri, 25 Dec 2015 01:52:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428819.html</guid><wfw:comment>http://www.aygfsteel.com/xiaomage234/comments/428819.html</wfw:comment><comments>http://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428819.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaomage234/comments/commentRss/428819.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaomage234/services/trackbacks/428819.html</trackback:ping><description><![CDATA[     摘要: 来源Q阮一峰的|络日志原文地址Qhttp://www.ruanyifeng.com/blog/2015/12/git-workflow.htmlGit 作ؓ一个源码管理系l,不可避免涉及到多人协作。协作必L一个规范的程Q让大家有效地合作,使得目井井有条地发展下厅R?协作程"在英语里Q叫?workflow"或?flow"Q原意是水流Q比喻项目像水流那样Q顺畅、自然地向前动Q不会发生冲?..  <a href='http://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428819.html'>阅读全文</a><img src ="http://www.aygfsteel.com/xiaomage234/aggbug/428819.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaomage234/" target="_blank">马?/a> 2015-12-25 09:52 <a href="http://www.aygfsteel.com/xiaomage234/archive/2015/12/25/428819.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>git清理I间http://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423866.html马?/dc:creator>马?/author>Thu, 26 Mar 2015 10:32:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423866.htmlhttp://www.aygfsteel.com/xiaomage234/comments/423866.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423866.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/423866.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/423866.html
from:http://beta.segmentfault.com/q/1010000002564327

作ؓ Repo 的维护者,最常见的事情就是从某一 ref 开始到 HEAD保留下来Q然后之前的历史删除。因个Q务比较常见,所以这里也有一?shell script 分nl你Q?/p>

#!/bin/bash git checkout --orphan temp $1 git commit -m "截取的历史记录v? git rebase --onto temp $1 master git branch -D temp 

使用的时候这P比如该脚本保存叫 git-detachQ: git-detach <ref>Q其?nbsp;<ref> 是你要保留的历史记录的L?/p>

需要注意的是,q个脚本只是把历史记?#8220;分离”开来,然后其中的一部分没有了可见的引用因此在历史记录里看不见,然而它们的 git object 仍然存在Q换a之你q能恢复q来Q自行查?nbsp;git-reflogQ,如果你真要彻底丢掉这些历ԌZl?repo 减肥Q,可以?nbsp;git gc --pruneQ那再也找不回来了?/p>

P.S. q个脚本依赖 Orphan BranchQ低版本?Git 不支持(大概?< v1.7.xQ,有替代方案自?Google ?br />

$ git filter-branch --tree-filter 'rm -f testme.txt' HEAD
Rewrite bb383961a2d13e12d92be5f5e5d37491a90dee66 (2/2)
Ref 'refs/heads/master'
 was rewritten
$ git ls-remote .
230b8d53e2a6d5669165eed55579b64dccd78d11        HEAD
230b8d53e2a6d5669165eed55579b64dccd78d11        refs/heads/master
bb383961a2d13e12d92be5f5e5d37491a90dee66        refs/original/refs/heads/master
$ git update-ref -d refs/original/refs/heads/master [bb383961a2d13e12d92be5f5e5d37491a90dee66]
$ git ls-remote .
230b8d53e2a6d5669165eed55579b64dccd78d11        HEAD
230b8d53e2a6d5669165eed55579b64dccd78d11        refs/heads/master
$ rm -rf .git/logs
$ git reflog --all
$ git prune
$ git gc
$ du -hs
 84K    .



]]>
Git 使用 - 2. 撤销、远E和打标?/title><link>http://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423848.html</link><dc:creator>马?/dc:creator><author>马?/author><pubDate>Thu, 26 Mar 2015 01:50:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423848.html</guid><wfw:comment>http://www.aygfsteel.com/xiaomage234/comments/423848.html</wfw:comment><comments>http://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423848.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaomage234/comments/commentRss/423848.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaomage234/services/trackbacks/423848.html</trackback:ping><description><![CDATA[<div>跟踪取消Q?                               $ git rm --cached x.txt</div><div> </div><div>跟踪取消的含义是Q把文g从git中拿出来Q不再进行版本跟t,但保留工作区的文件。操作前Q如果:</div><div> </div><div> </div><div>       1Q该文g处于已提交状态,则此操作把该文g|成“未跟t?#8221;状态,同时Q隐性的执行了该文g的需要提交删除操作。再执行 git commit -m "..."Q?该文件彻底从 repository 中删除?      此命令能执行是因?#8220;已暂?#8221;?#8220;已提?#8221;一致?/div><div> </div><div>       2Q该文g处于“已提?#8221;状态之后的“已修?#8221;。则此操作把该文件置?#8220;未跟t?#8221;状态,同时Q隐性的执行了该文g的需要提交删除操作。再执行 git commit -m "..."Q?该文件彻底从 repository 中删除。而且Q已l修改的文g保留Q不会丢失。此命o能执行是因ؓ“已暂?#8221;?#8220;已提?#8221;一致?/div><div> </div><div>       3Q该文g处于“已暂?#8221;状态之后未修改。则此操作把该文件置?#8220;未跟t?#8221;状态,同时Q隐性的执行了该文g的需要提交删除操作。再执行 git commit -m "..."Q?该文件彻底从 repository 中删除。此命o能执行是因ؓ“已提?#8221;?#8220;已修?#8221;一致?/div><div> </div><div> </div><div>       4Q该文g处于“已暂?#8221;状态之后的“已修?#8221;?        此命令不能执行,因ؓ“已暂?#8221;既与“已提?#8221;不一_也与“已修?#8221;不一_造成信息丢失的风险,因此Q对用户q行风险提示。如果强行删除,则需要加 -f , 卻I git rm -f --cached a.txt?l果是, 把该文g|成“未跟t?#8221;状态,同时Q隐性的执行了该文g的需要提交删除操作。再执行 git commit -m "..."Q?该文件彻底从 repository 中删除。此命o丢失?#8220;已暂?#8221;信息?/div><div> </div><div> </div><div>      注意Qgit rm -f --cached a.txt  ?git rm -f a.txt 之间的区别: 前者保留工作区的文Ӟ后者是全部删除?/div><div> </div><div>补充提交Q?                               $ git commit --amend</div><div>说明Q?如果上次提交之后没有Stage新的文gQ则q次补充提交只更新提交说明?/div><div>       如果有重新stage的文Ӟ则这ơ提交把该文件加入到上次提交Q即Q本ơ补充和上次提交合ƈ成一个?/div><div>暂存取消Q?                               $ git reset HEAD benchmarks.rb</div><div>注意Q如果一个文件已l暂存了一个版本,后来又暂存了一个更新的版本Q然后用git reset HEAD 取消后暂存的版本Q则W一ơ暂存的本版不会恢复?/div><div>修改取消Q?                               $ git checkout -- benchmarks.rb</div><div>注意:如果已暂存之后没提交Q进行了修改Q这个修改取消,使用已暂存来覆盖Q而不是已提交的;如果该已暂存已提交,则用已提交覆盖。也是_要想d的用已提交的版本覆盖本地修改Q则要查看该文g是否有已暂存Q如果有Q要用上一个命令先把它清除?/div><div>注意Q修改取消后Q无法恢复?/div><div>MQ只要提交的东西Q总能x设法扑֛来,但没提交的东西,一旦被覆盖Q就有可能永久丢失?/div><div></div><div>[q程操作]</div><div>昄配置了哪些远E服务器Q?                     $ git remote                                     </div><div>昄配置了哪些远E服务器Q同时显CURLQ?        $ git remote -v             </div><div>昄q程 详细信息Q?                            $ git remote show origin</div><div>修改q程标识名字Q?                             $ git remote rename pb paul</div><div>删除q程配置Q?                                 $ git remote rm paul</div><div>增加一个远E配|:                   $ git remote add pb git://github.com/paulboone/ticgit.git </div><div></div><div>获取Q?                             $ git fetch pb</div><div>或者:                               $ git fetch origin</div><div>注意Q?/div><div>1Q该分支可以?pb/master 讉K</div><div>2Q获取到本地之后Qƈ未自动mergeQ也未改变本CQ何东ѝ?/div><div>推送:                               $ git push origin master</div><div>注意Q推送的条gQ?/div><div>1Q从该远E克隆;</div><div>2Q有写权限;</div><div>3Q从上次克隆Q或推送)至今没有更新Q如果有更新Q则你要?fetch 然后再push?/div><div></div><div>标签操作Q?/div><div>查看所有标{:                               $ git tag</div><div>注意Q标{显C的序无太多含义?/div><div>查看特定标签Q?                              $ git tag -l 'v1.4.2.*'</div><div>打新标签Q?                                  $ git tag -a v1.4 -m 'my version 1.4'</div><div>昄某个标签Q?                              $ git show v1.4</div><div>{v标签Q?                                  $ git tag -s v1.5 -m 'my signed 1.5 tag'</div><div>轻量U标{:                                 $ git tag v1.6</div><div>验证标签Q?                                  $ git tag -v v1.4.2.1</div><div>后期加注标签Q?                              $ git log --pretty=oneline</div><div>                                             $ git tag -a v1.2 9fceb02</div><div>分nQ推送)标签Q?                          $ git push origin v1.5</div><div>分nQ推送)所有标{:                       $ git push origin --tags</div><img src ="http://www.aygfsteel.com/xiaomage234/aggbug/423848.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaomage234/" target="_blank">马?/a> 2015-03-26 09:50 <a href="http://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423848.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Git 使用 - 1. 文g操作和历史查?http://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423847.html马?/dc:creator>马?/author>Thu, 26 Mar 2015 01:47:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423847.htmlhttp://www.aygfsteel.com/xiaomage234/comments/423847.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423847.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/423847.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/423847.html【简介?nbsp;
版本控制pȝQVCS, Version Control SystemQ?可以分ؓ集中式(CVCS, Centralized Version Control System, ?CVS, SubversionQ和分布式(DVCS, Distributed Version Control SystemQ如 Git {)版本控制pȝ?/div>
传统的集中式版本控制pȝQ本地只保存代码库的一个版本拷贝?所有历史版本都保存在服务器。GIT 与之最大的不同是,本地不仅保存一个快照,而且保存着整个代码库(repositoryQ。因此它可以“ȝ”工作?nbsp;
?Window 上安装: http://code.google.com/p/msysgit
GIT h?LINUX 开发。Linux 开发早期(1992Q?002Q没有用版本控制工P直到 2002 q开始用一个非开源的工具 BitKeeper。一开始这个工兯l?Linux 免费使用Q后来想收费了,充满自由_ Linux 成员们肯定不会屈服于q个要挟Q一怒之下开发了一个自q版本控制工具?005 q_GIT 诞生 ?/div>
 
参考:官网Qhttp://git-scm.com/
     手册Qhttp://www.kernel.org/pub/software/scm/git/docs/
     参考:http://gitref.org/
     ProGit: http://progit.org/book/
【GIT 基础?/div>
 
GIT 使用 SHA-1 哈希码(40个字W)来标识提交,同时保证本次提交后整体(一个快照)的完整性?nbsp;
文g状态:
文g状态分为:未跟t?(untracked) 和已跟踪 (tracked)Q已跟踪又分ZU状态: 已暂存(stagedQ,已修改(modifiedQ,已提交(committedQ?/div>
一般过E如下:
1Q?新徏文gQ该文g状态ؓ“未跟t?#8221;Q位于工作区Q?/div>
2Q??git add a.txt  加入该文Ӟ状态变为已跟踪?#8220;已暂?#8221;Q位于暂存区Q?/div>
3Q??git commit a.txt -m "ha"  提交该文Ӟ状态变?#8220;已提?#8221;Q位于代码库Qrepository Q?/div>
或者,如果存在修改的情况,增加如下2.1?.2两个步骤Q?/div>
 
1Q?新徏文gQ该文g状态ؓ“未跟t?#8221;Q位于工作区Q?/div>
2Q??git add a.txt  加入该文Ӟ状态变为已跟踪?#8220;已暂?#8221;Q位于暂存区Q?/div>
2.1Q编辑该文gq保存,状态变?#8220;已修?#8221;Q位于工作区。(注意Q位于暂存区的文件独立存在!Q?/div>
2.2Q??git add a.txt  加入该文Ӟ状态变?#8220;已暂?#8221;Q位于暂存区。(注意Q原暂存区的文g被覆盖!Q?/div>
3Q??git commit a.txt -m "ha"  提交该文Ӟ状态变?#8220;已提?#8221;Q位于代码库Qrepository Q?/div>
考虑更广泛的情况Q状态迁Ud如下所C: 
Git <wbr>使用 <wbr>- <wbr>1. <wbr>文g操作和历史查?/div>
注意Q用 git status 查看目前所有文件的状态?/div>
GIT 配置Q?/div>
三种配置范围cdQ?/div>
1Q所有用?--systemQ?  存在 /etc/gitconfig 文g中?对windows来说Q是 msysgit 的安装目?
2Q本用户 --globalQ?   存在 ~/.gitconfig  文g中。(对windows 来说Q是 C:\Documents and Settings\$USERQ?/div>
3Q本目               存在 .git/config 文g中?/div>
注意Q后面的重蝲前面的。例如:?-global讄Q可以在所有项目中使用q个讄Q如果有一个项目你想用一个特别的讄Q就可以使用不带参数?git config 重新讄Q则它只作用于这个项目。如果用 git config --list 查看q些讄Q可能会列出多个Q但最后那个v作用?/div>
用户信息
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
文本~辑?/div>
$ git config --global core.editor emacs
查看配置信息
$ git config --list
或者只看一个信息:
$ git config <key>
【常用操作?nbsp;
QGIT 1.7.4 on  Windows)
获取帮助Q?                      $ git help <verb>
初始化仓库:                     $ git init
Q说明: 如果该目录有文gQ则都会处于“未跟t?#8221;状态的。)
克隆仓库Q?                      $ git clone git://github.com/schacon/grit.git
克隆仓库Qƈ换个名字Q?          $ git clone git://github.com/schacon/grit.git mygrit
跟踪一个新文gQ?                $ git add readme.txt
说明Q?nbsp;
1Q?跟踪之后Q该文g状态是“已暂?#8221;的?QChanges to be committed:Q?/div>
2Q修改一个已暂存的文Ӟ该文件会出现在两个记录区中?/div>
3Q?如果跟踪错了Q想把他删除Q不删除工作区的Q,则用 git rm --cached readme.txt。状态变?#8220;未跟t?#8221;Q如果该文g已经修改了,则加  -f 参数删除暂存区的文gQ已修改的文件不被覆盖)?/div>
跟踪一l新文gQ?                $ git add *.txt
跟踪一个目录中的所有文Ӟ       $ git add mydir
说明Q如果该目录下有子目录,则进行递归操作?/div>
修改之后Q暂存一个文Ӟ                           $ git add readme.txt
说明Q取消已暂存的文Ӟ已暂存到已修改)Q?        $ git reset HEAD readme.txt
忽略某些文gQ?                  ?gitignore 文g中加入下面两?    *.[oa]    *~
*.a       # 忽略所?.a l尾的文?/div>
!lib.a    # ?lib.a 除外
/TODO     # 仅仅忽略目根目录下?TODO 文gQ不包括 subdir/TODO
build/    # 忽略 build/ 目录下的所有文?/div>
doc/*.txt # 会忽?doc/notes.txt 但不包括 doc/server/arch.txt
注意Q?gitignore 文g攑֜工程的根目录卛_Q但是要把它?git add 加入跟踪或者提交?/div>
 
比较Q?/div>
查看未暂存的更斎ͼ                   $ git diff
说明Q比?#8220;已修?#8221;?#8220;已暂存(或已提交Q?#8221;?/div>
查看未提交的更?                    $ git diff --cached
      ?                              $ git diff --staged
说明Q比?#8220;已暂?#8221;和已提交?nbsp;
 
提交Q?/div>
提交更新Q只更新暂存中的Q:           $ git commit
提交更新Q只更新暂存中的Q:           $ git commit -m "task12, added implementation for usr mrg."
直接提交更新(更新暂存中的和已修改?Q?$ git commit -a -m "task12, added implementation forg."
从文件中取注释:                       $ git commit --file notefile
 
重新获取Q?/div>
抛弃已修改,用已提交覆盖               $ git checkout A.java
说明Q此命o对已暂存文g没作用?nbsp;
 
删除文gQ?/div>
从工作区可以直接删除文gQ这是运?git statusQ?昄Q?/div>
 
  Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
      deleted:    a
可以?git rm 删除 a。注意:如果 a 是已提交的文Ӟ则还需要运?git commit 以确保在代码库中删除。如果该文g未提交Q则无需q行git commit?nbsp;
也可以直接?git rm 删除文gQ但如何文g处于“已修?#8221; 则需要加 -f
U除已跟t文Ӟ恢复?#8220;未跟t?#8221;       $ git rm --cached A.java
说明Q如果文件已修改Q则需 -f Qƈ且不覆盖修改q的内容?nbsp;
U除修改后文?从暂存区和工作区中删?Q?     $ git rm -f a.a 
U除目录下的所有文Ӟ递归Q:                    $ git rm log/\*.log
U除目录下的所有文Ӟ无递归Q:                  $ git rm log/*.log
 
改名Q只改工作区和暂存区Q:                      $ git mv file1 file2
相当于:                                          $ mv README.txt README
                                                  $ git rm README.txt
                                                  $ git add README
历史查看 Q?/div>
查看提交历史(全部Q:                             $ git log
查看提交历史Qƈ昄l计信息Q?                   $ git log --stat
查看提交历史q查看差异:                          $ git log -p
查看最q?ơ提交历史ƈ查看差异Q?                  $ git log -p -2
查看最q?周内提交历史Q?                          $ git log --since=2.weeks
查看某个时刻之后的提交历Ԍ                      $ git log --since="2008-09-14"
查看某个时刻以前的提交历Ԍ                      $ git log --until="2008-09-14"
查看某个作者的提交历史Q?                         $ git log --author="stupid"
其他Q?/div>
-(n) 仅显C最q的 n 条提?/div>
--since, --after 仅显C指定时间之后的提交?/div>
--until, --before 仅显C指定时间之前的提交?/div>
--author 仅显C指定作者相关的提交?/div>
--committer 仅显C指定提交者相关的提交?/div>
例如Q?/div>
$ git log --pretty="%h:%s" --author=gitster --since="2008-10-01" \
   --before="2008-11-01" --no-merges -- t/
 
查看提交历史Qƈ单行昄Q?                       $ git log --pretty=oneline
查看提交历史Qƈ格式化显C:                      $ git log --pretty=format:"%h - %an, %ar : %s"
例如Q?/div>
$ git log --pretty=format:"%h - %an, %ar : %s"
ca82a6d - Scott Chacon, 11 months ago : changed the version number
085bb3b - Scott Chacon, 11 months ago : removed unnecessary test code
a11bef0 - Scott Chacon, 11 months ago : first commit
 
%H 提交对象QcommitQ的完整哈希字串
%h 提交对象的简短哈希字?/div>
%T 树对象(treeQ的完整哈希字串
%t 树对象的短哈希字?/div>
%P 父对象(parentQ的完整哈希字串
%p 父对象的短哈希字?/div>
%an 作者(authorQ的名字
K?作者的电子邮g地址
K?作者修订日期(可以?-date= 选项定制格式Q?/div>
%ar 作者修订日期,按多久以前的方式昄
%cn 提交?committer)的名?/div>
K?提交者的电子邮g地址
K?提交日期
%cr 提交日期Q按多久以前的方式显C?/div>
%s 提交说明
 
查看提交历史Qƈ囑Ş化显C:               $ git log --pretty=format:"%h %s" --graph
例如Q?/div>
$ git log --pretty=format:"%h %s" --graph
* 2d3acf9 ignore errors from SIGCHLD on trap
*  5e3ee11 Merge branch 'master' of git://github.com/dustin/grit
|\
| * 420eac9 Added a method for getting the current branch.
* | 30e367c timeout code and tests
* | 5a09431 add timeout protection to grit
* | e1193f8 support for heads with slashes in them
|/
* d6016bc require time for xmlschema
*  11d191e Merge branch 'defunkt' into local
 
其它Q?/div>
-p 按补丁格式显C每个更C间的差异?/div>
--stat 昄每次更新的文件修改统计信息?/div>
--shortstat 只显C?--stat 中最后的行数修改dU除l计?/div>
--name-only 仅在提交信息后显C已修改的文件清单?/div>
--name-status 昄新增、修攏V删除的文g清单?/div>
--abbrev-commit 仅显C?SHA-1 的前几个字符Q而非所有的 40 个字W?/div>
--relative-date 使用较短的相Ҏ间显C(比如Q?#8220;2 weeks ago”Q?/div>
--graph 昄 ASCII 囑Ş表示的分支合q历双Ӏ?/div>
--pretty 使用其他格式昄历史提交信息。可用的选项包括 onelineQshortQfullQfuller ?formatQ后跟指定格式)?/div>
 
最重要的是Q如果你觉着上面q些查看历史的命令太隄Q你可以使用囑Ş化工PgitkQ一切都清晰了?/div>

]]>Git 使用 - 3. 分支, merge, rebasehttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423846.html马?/dc:creator>马?/author>Thu, 26 Mar 2015 01:26:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423846.htmlhttp://www.aygfsteel.com/xiaomage234/comments/423846.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/03/26/423846.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/423846.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/423846.html[基本概念] 
GIT branch 的本质是一个提交链表的指针。创Z个新的branchQ实质是创徏了当时提交链表的一个新指针。该指针和原指针独立操作Q各自叠加新的提交后QŞ成各自的分支链?/div>
“在分支上”的含义,新徏一个分支之后,建立此分支以前的提交也称为在q个分支上?/div>
HEAD的含义:当前branch?随着git branch checkout <branch> 改变?/div>
分支不是UŞ性:如果发生qmergeQ则即 HEAD 相同Q链表也不具有唯一性。(x些提交有多父情况Q?/div>
 
Z么要及时删掉不用的分支:防止提交查看时显C多的分支?/div>
merge Ӟ如果自动merge没有冲突Q则 GIT 产生一个新的提交。如果有 冲突Q则GIT产生一个未提交?/div>
实践中,可以有三个分支:
1Q?master
2Q?dev
3Q?TopicQ针Ҏ个具体问题,短期存在Q需要经常的rebase?/div>
问题Q如果删除一个分支,那么它上面的?merge 的提交会一起删除吗Q?/div>
[基本操作]
查看分支:                                       $ git branch
创徏分支Q?                                     $ git branch mybranch
切换分支Q?                                     $ git checkout mybranch
创徏q切换分支:                                $ git checkout -b mybranch
合ƈ分支Q?merge from)                          $ git checkout master
                                                $ git merge mybranch   (merge from mybranch)
使用 merge工具Q有冲突的情况下Q:              $ git mergetool
删除分支Q?                                     $ git branch -d mybranch
强制删除分支 (上面有尚?merge 的提?Q?       $ git branch -D mybranch
列出所有分支:                                  $ git branch
查看各个分支最后一ơ提交:                      $ git branch -v
查看哪些分支合ƈ入当前分支(可以删了Q:        $ git branch --merged
查看哪些分支未合q入当前分支Q?                 $ git branch --no-merged
q程Q?nbsp;
更新q程库到本地Q?                             $ git fetch origin
如果有新分支Q则分支名:orgin/<branch>
 
取远E分支合q到本地分支Q?                     $ git merge origin/mybranch
用远E分支徏一个本地分支:                      $ git checkout -b mybranch origin/mybranch
推送分支:                                      $ git push origin mybranch
 
推送分支,q换个名字:                          $ git push origin serverfix:awesomebranc
删除q程分支Q                 $ git push origin  :mybranch
 
rebase:                                         $ git checkout mybranch
                                                $ git rebase master    (rebase from master)
 
举例Q?                                         $ git checkout server
                                                $ git rebase --onto master server client
                                                $ git checkout master
                                                $ git merge client  (fostforward)
                                                $ git rebase master server  (checkout sever)
                                                $ git merge server
                                                $ git branch -d client
                                                $ git branch -d server
 
merge ?rebase 的区别:
1Q,从文件结果看Qmerge ?rebase 可以辑ֈ同样效果?nbsp;
2Q,从历史纪录看Q他们存在差异:merge 昄合ƈ后的多父l点Q呈现环形, ?rebase 呈现U性结果,卛_对分支历史进行合q操作。rebase 提供更好的历史呈现方式(似分支从未曾发生q)Q但有风险?掌握一条原则:Do not rebase commits that you have pushed to a public repository. 卻I不要对你提交q的分支q行 rebase。因为本地的改变会造成q端的困惑?nbsp;
3Q, 在实践中Q可以尽量用 mergeQ慎?rebase?/div>

]]>git tag ?标签相关操作http://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423670.html马?/dc:creator>马?/author>Fri, 20 Mar 2015 03:41:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423670.htmlhttp://www.aygfsteel.com/xiaomage234/comments/423670.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423670.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/423670.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/423670.html

标签可以针对某一旉点的版本做标讎ͼ常用于版本发布?br />

  • 列出标签

$ git tag # 在控制台打印出当前仓库的所有标{?br />$ git tag -l ‘v0.1.*’ # 搜烦W合模式的标{?/p>

  • 打标{?/li>

git标签分ؓ两种cdQ轻量标{֒附注标签。轻量标{是指向提交对象的引用,附注标签则是仓库中的一个独立对象。徏议用附注标{?br /># 创徏轻量标签
$ git tag v0.1.2-light

# 创徏附注标签
$ git tag -a v0.1.2 -m “0.1.2版本”

创徏轻量标签不需要传递参敎ͼ直接指定标签名称卛_?br />创徏附注标签Ӟ参数a即annotated的羃写,指定标签cdQ后附标{֐。参数m指定标签说明Q说明信息会保存在标{֯象中?/p>

  • 切换到标{?/li>

与切换分支命令相同,?code style="border: 0px; font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace; font-size: 13px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; line-height: normal;">git checkout [tagname]
查看标签信息
?code style="border: 0px; font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace; font-size: 13px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; line-height: normal;">git show命o可以查看标签的版本信息:
$ git show v0.1.2

  • 删除标签

误打或需要修Ҏ{时Q需要先标{ֈ除,再打新标{?br />$ git tag -d v0.1.2 # 删除标签

参数d即delete的羃写,意ؓ删除其后指定的标{?/p>

  • l指定的commit打标{?/li>

打标{不必要在head之上Q也可在之前的版本上打,q需要你知道某个提交对象的校验和Q通过git log获取Q?br /># 补打标签
$ git tag -a v0.1.1 9fbc3d0

  • 标签发布

通常?code style="border: 0px; font-family: Monaco, Consolas, 'Andale Mono', 'DejaVu Sans Mono', monospace; font-size: 13px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; line-height: normal;">git push不会标{֯象提交到git服务器,我们需要进行显式的操作Q?br />$ git push origin v0.1.2 # v0.1.2标签提交到git服务?br />$ git push origin –tags # 本地所有标{一ơ性提交到git服务?/p>

 

注意Q如果想看之前某个标{态下的文Ӟ可以q样操作

1.git tag   查看当前分支下的标签

2.git  checkout v0.21   此时会指向打v0.21标签时的代码状态,Q但现在处于一个空的分支上Q?/p>

3. cat  test.txt   查看某个文g


refer toQhttp://www.csser.com/dev/580.html



]]>?SVN q移?GitQ{Q?/title><link>http://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423664.html</link><dc:creator>马?/dc:creator><author>马?/author><pubDate>Fri, 20 Mar 2015 02:57:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423664.html</guid><wfw:comment>http://www.aygfsteel.com/xiaomage234/comments/423664.html</wfw:comment><comments>http://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423664.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaomage234/comments/commentRss/423664.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaomage234/services/trackbacks/423664.html</trackback:ping><description><![CDATA[<p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;">转:http://beginor.github.io/2013/03/12/migrate-from-svn-to-git.html</p><p style="color: #333333; font-family: Arial; line-height: 26px; background-color: #ffffff;"></p><div style="color: #333333; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 20px; background-color: #ffffff;"><h3><a name="t0" style="color: rgb(51, 102, 153); width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif); background-repeat: no-repeat;"></a>准备工作</h3><p style="margin-top: 16px; margin-bottom: 16px;">认所有用L本地修改都签入到服务器, ?SVN 源代码的分支可能的合ƈCqԌ 已经发布的做好归档信息, q备?SVN 库?虽然q移?Git 的风险不大, 但是备䆾一下L好的?/p><p style="margin-top: 16px; margin-bottom: 16px;">安装 Git Q?q看h是废话, 不装 Git 怎么q移Q?/p><h3><a name="t1" style="color: rgb(51, 102, 153); width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif); background-repeat: no-repeat;"></a>用h到 Git</h3><p style="margin-top: 16px; margin-bottom: 16px;">创徏一个用h文Ӟ ?SVN 用户映射?Git 用户Q?q样可以保留用户的签入历史信息, 比如用户输入的修改记录等Q?q个文g看v来是q样子的Q?/p><pre style="white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857143; word-break: break-all; border: 0px solid #cccccc; background-color: #f5f5f5;"><code nginx"="" style="display: block; padding: 0.5em; color: black; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; overflow-x: auto; background: transparent;"><span style="color: #000088; font-weight: bold;">svnuser1</span> = gituser1 <gituser1<span style="color: #660066;">@yourcompany</span>.com> svnuser2 = gituser2 <gituser2<span style="color: #660066;">@yourcompany</span>.com> </code></pre><p style="margin-top: 16px; margin-bottom: 16px;">q样Q?用户 svnuser1 {օ的历史信息在q移之后׃映射?gituser1 Q?svnuser2 映射E?gituser2 ?/p><p style="margin-top: 16px; margin-bottom: 16px;">~辑好用h文件之后, 保存?users.txt ?/p><h3><a name="t2" style="color: rgb(51, 102, 153); width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif); background-repeat: no-repeat;"></a>克隆 SVN ?/h3><p style="margin-top: 16px; margin-bottom: 16px;">假设 svn 库的布局是标准的 trunk ?branches 以及 tags Q?q行下面的命令开始克?svn 库:</p><pre style="white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857143; word-break: break-all; border: 0px solid #cccccc; background-color: #f5f5f5;"><code xml"="" style="display: block; padding: 0.5em; color: black; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; overflow-x: auto; background: transparent;">git svn clone <span style="color: #006666;"><<span style="color: #000088; font-weight: bold;">svn</span> <span style="color: #660066;">repo</span> <span style="color: #660066;">url</span>></span> --no-metadata -A users.txt -t tags -b branches -T trunk <span style="color: #006666;"><<span style="color: #000088; font-weight: bold;">destination</span> <span style="color: #660066;">dir</span> <span style="color: #660066;">name</span>></span> </code></pre><p style="margin-top: 16px; margin-bottom: 16px;">Git 会克?svn 完整的历史记录, 可能会需要很长的旉Q??svn 库的历史而定?/p><h3><a name="t3" style="color: rgb(51, 102, 153); width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif); background-repeat: no-repeat;"></a>转换分支及归?/h3><p style="margin-top: 16px; margin-bottom: 16px;">克隆完成之后Q?所有的 svn 归档?git 看来都是q程分支 (remote tags) Q?不是真正?git 归档Q?需要将他们手工转换?git 归档Q?然后再删除远E分支, 对于每一个分支或归档Q?做如下操作(?v1.0.1 归档ZQ:</p><pre style="white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857143; word-break: break-all; border: 0px solid #cccccc; background-color: #f5f5f5;"><code bash"="" style="display: block; padding: 0.5em; color: black; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; overflow-x: auto; background: transparent;">git tag v1.<span style="color: #008800;">0.1</span> tags/v1.<span style="color: #008800;">0.1</span> git branch -r -d tags/v1.<span style="color: #008800;">0.1</span> </code></pre><p style="margin-top: 16px; margin-bottom: 16px;">所有的归档信息处理完成之后Q?git 本地库就有了完整的历史记录?/p><h3><a name="t4" style="color: rgb(51, 102, 153); width: 20px; height: 20px; text-indent: 20px; background-image: url(http://www.aygfsteel.com/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif); background-repeat: no-repeat;"></a>提交?Git ?/h3><p style="margin-top: 16px; margin-bottom: 16px;">现在可以攑ֿ的将代码提交到自q git 服务器了Q?命o如下Q?/p><pre style="white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; font-size: 13px; padding: 9.5px; margin-top: 0px; margin-bottom: 10px; line-height: 1.42857143; word-break: break-all; border: 0px solid #cccccc; background-color: #f5f5f5;"><code perl"="" style="display: block; padding: 0.5em; color: black; font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; overflow-x: auto; background: transparent;">git remote add origin git<span style="color: #660066;">@github</span>.com:userid/project.git git <span style="color: #000088; font-weight: bold;">push</span> origin master --tags </code></pre><p style="margin-top: 16px; margin-bottom: 16px;">ȝ来说Q??svn q移?git q是很容易的?/p></div><img src ="http://www.aygfsteel.com/xiaomage234/aggbug/423664.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaomage234/" target="_blank">马?/a> 2015-03-20 10:57 <a href="http://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423664.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>git分支理http://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423665.html马?/dc:creator>马?/author>Fri, 20 Mar 2015 02:57:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423665.htmlhttp://www.aygfsteel.com/xiaomage234/comments/423665.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/03/20/423665.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/423665.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/423665.htmlGit如何q行分支理Q?br style="margin: 0px; padding: 0px;" />     1、创建分?br style="margin: 0px; padding: 0px;" />     创徏分支很简单:git branch <分支?gt;
     2、切换分?br style="margin: 0px; padding: 0px;" />     git checkout <分支?gt;
     该语句和上一个语句可以和h用一个语句表C:git checkout -b <分支?gt;
     3、分支合q?br style="margin: 0px; padding: 0px;" />     比如Q如果要开发中的分支(developQ,合ƈ到稳定分支(masterQ,
     首先切换的master分支Qgit checkout master?br style="margin: 0px; padding: 0px;" />     然后执行合ƈ操作Qgit merge develop?br style="margin: 0px; padding: 0px;" />     如果有冲H,会提CZQ调用git status查看冲突文g?br style="margin: 0px; padding: 0px;" />     解决冲突Q然后调用git add或git rm解军_的文件暂存?br style="margin: 0px; padding: 0px;" />     所有冲H解军_Qgit commit 提交更改?br style="margin: 0px; padding: 0px;" />     4、分支衍?br style="margin: 0px; padding: 0px;" />     分支衍合和分支合q的差别在于Q分支衍合不会保留合q的日志Q不留痕q,?分支合ƈ则会保留合ƈ的日志?br style="margin: 0px; padding: 0px;" />     要将开发中的分支(developQ,衍合到稳定分支(masterQ?br style="margin: 0px; padding: 0px;" />     首先切换的master分支Qgit checkout master?br style="margin: 0px; padding: 0px;" />     然后执行衍和操作Qgit rebase develop?br style="margin: 0px; padding: 0px;" />     如果有冲H,会提CZQ调用git status查看冲突文g?br style="margin: 0px; padding: 0px;" />     解决冲突Q然后调用git add或git rm解军_的文件暂存?br style="margin: 0px; padding: 0px;" />     所有冲H解军_Qgit rebase --continue 提交更改?br style="margin: 0px; padding: 0px;" />     5、删除分?br style="margin: 0px; padding: 0px;" />     执行git branch -d <分支?gt;
     如果该分支没有合q到d支会报错Q可以用以下命o强制删除git branch -D <分支?gt;

http://winuxxan.blog.51cto.com/2779763/508955



]]>
CI pȝ搭徏Q二. GitLab 的安装配|?/title><link>http://www.aygfsteel.com/xiaomage234/archive/2015/03/19/423628.html</link><dc:creator>马?/dc:creator><author>马?/author><pubDate>Thu, 19 Mar 2015 08:37:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaomage234/archive/2015/03/19/423628.html</guid><wfw:comment>http://www.aygfsteel.com/xiaomage234/comments/423628.html</wfw:comment><comments>http://www.aygfsteel.com/xiaomage234/archive/2015/03/19/423628.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaomage234/comments/commentRss/423628.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaomage234/services/trackbacks/423628.html</trackback:ping><description><![CDATA[<h2>from:<span style="font-size: 14px;">http://longgeek.com/2013/12/26/ci-system-structures-ii-gitlab-installation/#i-3</span></h2><p style="margin: 0px 0px 2em; line-height: 22.3999996185303px; color: #666666; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; background-color: #ffffff;"><span style="font-size: 12px;">2013-12-26?| 标签: <a rel="tag" style="color: #666666; text-decoration: none;">CI</a> <a rel="tag" style="color: #666666; text-decoration: none;">Git</a> <a rel="tag" style="color: #666666; text-decoration: none;">Gitlab</a> | 作者:<a title="" rel="author" style="color: #666666; text-decoration: none;">Geek</a></span></p><div style="color: #333333; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif; line-height: 22.3999996185303px; background-color: #ffffff;"><h2><a rel="bookmark" title="Permanent Link to CI pȝ搭徏Q二. GitLab 的安装配|? style="color: #336699; text-decoration: none;"></a></h2><div><form name="pdf24Form0" method="post" action="http://doc2pdf.pdf24.org/wordpress.php" target="pdf24PopWin"><a target="_blank" title="PDF24 Creator" style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/plugins/pdf24-posts-to-pdf/img/sheep_16x16.gif" alt="PDF24 Creator" border="0" width="16" height="16" style="border: medium none; max-width: 580px; height: auto;" /></a>    Send article as <a target="_blank" style="text-decoration: none; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit;">PDF</a>    <input type="text" name="sendEmailTo" value="Enter email address" style="margin: 0px;" /> <input type="submit" value="Send" style="margin: 0px;" /></form></div><p style="margin: 0px 0px 1em;">上一文?nbsp;<a style="color: #336699; text-decoration: none;">CI pȝ搭徏Q一. 基础环境讄、规?nbsp;</a>大概规划了下环境Q本文主要用来记录安?Gitlab 的过E,<a style="color: #336699; text-decoration: none;">主要参考官Ҏ?/a> q没有做太多的修攏V?/p><p style="margin: 0px 0px 1em;"></p><div class="wmqeeuq" id="toc_container" no_bullets"=""><p style="margin: 0px 0px 1em;">目录</p><ul><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">1</span> 讄?/a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">2</span> 安装依赖?/a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">3</span> pȝ用户</a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">4</span> GitLab Shell</a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">5</span> Mysql</a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">6</span> GitLab</a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">7</span> Nginx</a></li><li style="list-style-type: square;"><a style="color: #336699; text-decoration: none;"><span toc_depth_1"="">8</span> 界面单?/a></li></ul></div><h3><span id="i">讄?/span></h3><p style="margin: 0px 0px 1em;"><em>讄国内 163 apt ?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;"># vim /etc/apt/sources.list deb http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse deb http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted deb http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted deb http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted deb http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted deb-src http://mirrors.163.com/ubuntu/ precise main universe restricted multiverse deb-src http://mirrors.163.com/ubuntu/ precise-security universe main multiverse restricted deb-src http://mirrors.163.com/ubuntu/ precise-proposed universe main multiverse restricted deb-src http://mirrors.163.com/ubuntu/ precise-backports universe main multiverse restricted deb-src http://mirrors.163.com/ubuntu/ precise-updates universe main multiverse restricted # apt-get update </code></pre><hr /><h3><span id="i-2">安装依赖?/span></h3><p style="margin: 0px 0px 1em;"><em>Gitlab 依赖包、库</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev \ libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall \ libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate </code></pre><p style="margin: 0px 0px 1em;"><em>安装 markdown 文档风格依赖?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y python-docutils </code></pre><p style="margin: 0px 0px 1em;"><em>安装 gitQGerrit 依赖 gitwebQ同?GitLab 依赖 git 版本 >= 1.7.10QUbuntu apt-get 默认安装的是 1.7.9.5Q当然不升也是没有问题?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y git git-core gitweb git-review </code></pre><p style="margin: 0px 0px 1em;"><em>升 Git 版本Q可选)</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y git gitweb sudo apt-get remove git-core sudo apt-get install -y libcurl4-openssl-dev libexpat1-dev gettext libz-dev libssl-dev build-essential cd /tmp curl --progress https://git-core.googlecode.com/files/git-1.8.4.1.tar.gz | tar xz cd git-1.8.4.1/ make prefix=/usr/local all sudo make prefix=/usr/local install # * 如果升?git 的版本,相应修改 Gitlab.yml 中的 git 脚本位置Q这一步在 clone gitlab 后在操作* sudo -u git -H vim /home/git/gitlab/config/gitlab.yml bin_path: /usr/local/bin/git </code></pre><p style="margin: 0px 0px 1em;"><em>Gitlab 需要收发邮Ӟ安装邮g服务?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y postfix </code></pre><p style="margin: 0px 0px 1em;"><em>如果安装?ruby1.8Q卸载掉QGitlab 依赖 2.0 以上</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get remove ruby1.8 </code></pre><p style="margin: 0px 0px 1em;"><em>下蝲~译 ruby2.0</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">mkdir /tmp/ruby && cd /tmp/ruby curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz cd ruby-2.0.0-p353 ./configure --disable-install-rdoc make sudo make install </code></pre><p style="margin: 0px 0px 1em;"><em>修改 gem 源指?taobao</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">gem source -r https://rubygems.org/ gem source -a http://ruby.taobao.org/ </code></pre><p style="margin: 0px 0px 1em;"><em>安装 Bundel 命o</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo gem install bundler --no-ri --no-rdoc </code></pre><hr /><h3><span id="i-3">pȝ用户</span></h3><p style="margin: 0px 0px 1em;"><em>l?Gitlab 创徏一?git 用户</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo adduser --disabled-login --gecos 'GitLab' git </code></pre><hr /><h3><span id="GitLab_Shell">GitLab Shell</span></h3><p style="margin: 0px 0px 1em;"><em>下蝲 Gitlab ShellQ用?ssh 讉K仓库的管理Y?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git cd gitlab-shell sudo -u git -H cp config.yml.example config.yml </code></pre><p style="margin: 0px 0px 1em;"><em>修改 gitlab-shell/config.yml</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo -u git -H vim /home/git/gitlab-shell/config.yml gitlab_url: "http://gitlab.thstack.com/" </code></pre><p style="margin: 0px 0px 1em;"><em>安装 GitLab Shell</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab-shell sudo -u git -H ./bin/install </code></pre><hr /><h3><span id="Mysql">Mysql</span></h3><p style="margin: 0px 0px 1em;"><em>安装 Mysql ?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev </code></pre><p style="margin: 0px 0px 1em;"><em>l?Gitlab 创徏 Mysql 数据库ƈ授权用户讉K</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo mysql -uroot -p > create database gitlabdb; > grant all on gitlabdb.* to 'gitlabuser'@'localhost' identified by 'gitlabpass'; </code></pre><hr /><h3><span id="GitLab">GitLab</span></h3><p style="margin: 0px 0px 1em;"><em>下蝲 GitLab 源代码,q切换到最新的分支?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab cd gitlab sudo -u git -H git checkout 6-4-stable </code></pre><p style="margin: 0px 0px 1em;"><em>配置 GitLabQ修?gitlab.ymlQ其?hostQ?和 gitlab-shell ?gitlab_url 的主Z?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml sudo -u git -H vim config/gitlab.yml host: gitlab.thstack.com email_from: gitlab@thstack.com support_mail: gitlab@thstack.com signup_enabled: true Q开启用h?</code></pre><p style="margin: 0px 0px 1em;"><em>创徏相关目录</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab sudo -u git -H mkdir tmp/pids/ sudo -u git -H mkdir tmp/sockets/ sudo -u git -H mkdir public/uploads sudo -u git -H mkdir /home/git/repositories sudo -u git -H mkdir /home/git/gitlab-satellites </code></pre><p style="margin: 0px 0px 1em;"><em>修改相关目录权限</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo chown -R git:git log/ tmp/ sudo chmod -R u+rwX log/ tmp/ public/uploads </code></pre><p style="margin: 0px 0px 1em;"><em>修改 unicorn.rb 监听端口为:8081</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb sudo -u git -H vim config/unicorn.rb listen "gitlab.thstack.com:8081", :tcp_nopush => true </code></pre><p style="margin: 0px 0px 1em;"><em>配置 GitLab 讉K mysql 数据库设|?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git cp config/database.yml.mysql config/database.yml sudo -u git -H vim config/database.yml *修改 Production 部分:* production: adapter: mysql2 encoding: utf8 reconnect: false database: gitlabdb pool: 10 username: gitlabuser password: "gitlabpass" host: localhost socket: /var/run/mysqld/mysqld.sock </code></pre><p style="margin: 0px 0px 1em;"><em>讄 GitLab 使用指定邮箱发送邮Ӟ注意 production.rb 的文件格式,开头空两格</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git -H vim config/environments/production.rb #修改 :sendmail ?:smtp config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.googlemail.com", :port => 587, :domain => 'thstack.com', :user_name => 'gitlab@thstack.com', :password => 'password', :authentication => :plain, :enable_starttls_auto => true } end # 上面内容加入?end 里面 </code></pre><p style="margin: 0px 0px 1em;"><em>安装 gem</em></p><p style="margin: 0px 0px 1em;">修改 Gemfile 文g中源指向?taobao</p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git -H vim Gemfile source "http://ruby.taobao.org/" </code></pre><p style="margin: 0px 0px 1em;">虽然在文件中指向了国?taobao 源,但是依然会卡一会,耐心{待…</p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git -H bundle install --deployment --without development test postgres aws </code></pre><p style="margin: 0px 0px 1em;"><em>初始化数据库q激z高U功?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production </code></pre><p style="margin: 0px 0px 1em;">输入 yes 来初始化数据库、创建相兌Q最后会输出 GitLab Web 理员用来登录的账号和密?/p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">Do you want to continue (yes/no)? yes ... Administrator account created: login.........admin@local.host password......5iveL!fe </code></pre><p style="margin: 0px 0px 1em;"><em>讄 GitLab 启动服务</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo update-rc.d gitlab defaults 21 </code></pre><p style="margin: 0px 0px 1em;"><em>讄 GitLab 使用 Logrotate 备䆾 Log</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab </code></pre><p style="margin: 0px 0px 1em;"><em>查GitLab及其环境的配|是否正:</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab/ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production System information System: Ubuntu 12.04 Current User: git Using RVM: no Ruby Version: 2.0.0p353 Gem Version: 2.0.14 Bundler Version:1.3.5 Rake Version: 10.1.0 GitLab information Version: 6.4.2 Revision: 214a013 Directory: /home/git/gitlab DB Adapter: mysql2 URL: http://gitlab.thstack.com HTTP Clone URL: http://gitlab.thstack.com/some-project.git SSH Clone URL: git@gitlab.thstack.com:some-project.git Using LDAP: no Using Omniauth: no GitLab Shell Version: 1.8.0 Repositories: /home/git/repositories/ Hooks: /home/git/gitlab-shell/hooks/ Git: /usr/bin/git </code></pre><p style="margin: 0px 0px 1em;"><em>启动 GitLab 服务</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">/etc/init.d/gitlab restart Shutting down both Unicorn and Sidekiq. GitLab is not running. Starting both the GitLab Unicorn and Sidekiq.. The GitLab Unicorn web server with pid 17771 is running. The GitLab Sidekiq job dispatcher with pid 17778 is running. GitLab and all its components are up and running </code></pre><p style="margin: 0px 0px 1em;"><em>最后编译一?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production </code></pre><hr /><h3><span id="Nginx">Nginx</span></h3><p style="margin: 0px 0px 1em;"><em>安装 Nginx ?/em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">sudo apt-get install -y nginx </code></pre><p style="margin: 0px 0px 1em;"><em>配置 Nginx</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">cd /home/git/gitlab sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab sudo vim /etc/nginx/sites-available/gitlab listen *:80 default_server; server_name gitlab.thstack.com; proxy_pass http://gitlab.thstack.com:8081; </code></pre><p style="margin: 0px 0px 1em;"><em>启动 Nginx</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">/etc/init.d/apache2 stop /etc/init.d/nginx restart </code></pre><p style="margin: 0px 0px 1em;"><em>讉K</em></p><pre style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto; padding: 1em; line-height: 1.5em; border: 1px solid #dddddd; margin-top: 1.5em; margin-bottom: 1.5em; background-color: #edf1ff;"><code style="font-family: 'Courier New', Courier, Monaco, 'Lucida Console', monospace; overflow: auto;">用浏览器讉K: http://gitlab.thstack.com 用户名:admin@local.host 密码Q?iveL!fe </code></pre><p style="margin: 0px 0px 1em;"><a style="color: #336699; text-decoration: none;">2</a>: https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/insta llation.md</p><h3><span id="i-4">界面单?/span></h3><p style="margin: 0px 0px 1em;">使用 admin@local.host 账号dQ?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-login.jpg" alt="gitlab-login" width="1668" height="1350" size-full="" wp-image-1581"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">d后系l让修改密码Q先修改密码Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-set_pass.jpg" alt="gitlab-set_pass" width="1600" height="1378" size-full="" wp-image-1585"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">修改完密码后Q用新密码登录一下,然后修改 Admin 用户得邮地址为:admin@thstack.com <a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-set-email.jpg" alt="gitlab-set-email" width="1698" height="1378" size-full="" wp-image-1586"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">点击保存更改后,pȝ会自动给刚才输入的邮地址发送一确认修改信息,点击邮g内容中的q接后会自动用新账号邮箱d?/p><p style="margin: 0px 0px 1em;">创徏一?GROUPQ?/p><p style="margin: 0px 0px 1em;"><a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-click-group.jpg" alt="gitlab-click-group" width="1712" height="1418" size-full="" wp-image-1573"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">输入 Group 名字为:DevGroup <a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-create-gourp.jpg" alt="gitlab-create-gourp" width="1698" height="1404" size-full="" wp-image-1577"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">点击创徏目Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-click-project.jpg" alt="gitlab-click-project" width="1672" height="1392" size-full="" wp-image-1574"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">创徏一个项目,名ؓQOpenStackQ这个项目属?DevGroup: <a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-create-project.jpg" alt="gitlab-create-project" width="1662" height="1382" size-full="" wp-image-1578"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">创徏完项目后Q点L?ssh 密钥Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-click-sshkey.jpg" alt="gitlab-click-sshkey" width="1688" height="1388" size-full="" wp-image-1575"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">生成 admin@thstack.com 邮箱密钥Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-gen-sshkey.jpg" alt="gitlab-gen-sshkey" width="1808" height="1382" size-full="" wp-image-1580"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">在界面输入刚才生成得密钥Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-add-sshkey.jpg" alt="gitlab-add-sshkey" width="1650" height="1380" size-full="" wp-image-1572"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">再注册一个̎Pd面点击注册按钮Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-click-user.jpg" alt="gitlab-click-user" width="1706" height="1404" size-full="" wp-image-1576"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">注册一?Longgeek 用户Q输入邮、密码,然后去输入得邮箱验证Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-create-user.jpg" alt="gitlab-create-user" width="1610" height="1338" size-full="" wp-image-1579"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">创徏一?Longgeek 用户Qƈ生成密钥Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-longgeek-gen-sshkey.jpg" alt="gitlab-longgeek-gen-sshkey" width="3360" height="1948" size-full="" wp-image-1583"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">?longgeek@thstack.com 用户d GitLabQ添加刚才生成得密钥?sshkey 里: <a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-longgeek-add-sshkey.jpg" alt="gitlab-longgeek-add-sshkey" width="1704" height="1382" size-full="" wp-image-1582"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">?admin@thstack.com 用户d GitLabQ把 longgeek@thstack.com d?DevGroup l中Q权限是 ReporterQ这?longgeek 用户也可以访?OpenStack q个目Q不q没有权限直?PushQ?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-add-longgeek-gourp.jpg" alt="gitlab-add-longgeek-gourp" width="1678" height="1412" size-full="" wp-image-1571"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">?longgeek@thstack.com 用户d可以看?OpenStack 目Q?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-longgeek-view-project.jpg" alt="gitlab-longgeek-view-project" width="1664" height="1382" size-full="" wp-image-1584"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">?longgeek@thstack.com clone 目Q尝?pushQ?nbsp;<a style="color: #336699; text-decoration: none;"><img src="http://longgeek.com/wp-content/uploads/2013/12/gitlab-longgeek-try-push1.jpg" alt="gitlab-longgeek-try-push" width="1978" height="1808" size-full="" wp-image-1588"="" style="border: medium none; max-width: 580px; height: auto;" /></a></p><p style="margin: 0px 0px 1em;">很显?longgeek 用户是没?push ?master 分支得权限。接下来会安?Gerrit、Jenkins。以及它们三个如何整合成程。请参考后面得文章?/p></div><img src ="http://www.aygfsteel.com/xiaomage234/aggbug/423628.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaomage234/" target="_blank">马?/a> 2015-03-19 16:37 <a href="http://www.aygfsteel.com/xiaomage234/archive/2015/03/19/423628.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>用GitLab搭徏自己的私有GitHubhttp://www.aygfsteel.com/xiaomage234/archive/2015/01/14/422225.html马?/dc:creator>马?/author>Wed, 14 Jan 2015 06:44:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2015/01/14/422225.htmlhttp://www.aygfsteel.com/xiaomage234/comments/422225.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2015/01/14/422225.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/422225.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/422225.html

Gitlab是一个用Ruby on Rails开发的开源项目管理程序,可以通过WEB界面q行讉K公开的或者私人项目。它和Github有类似的功能Q能够浏览源代码Q管理缺陷和注释?/p>

下面介绍如何?Debian/Ubuntu ?Centos 下搭建配|?GitLab?/p>

安装依赖

Debian/Ubuntu下:

sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev logrotate 

安装python(注意需?.5以上版本)Q?/p>

sudo apt-get install -y python python-docutils 

安装gitQ注意需?.7.10以上版本Q:

sudo apt-get install -y git-core 

Centos下官方仓库的软g比较老旧Q推?a rel="nofollow" target="_blank" style="box-sizing: border-box; color: #008e59; text-decoration: none; outline: 0px; background: transparent;">先添加epel?/a>Q然后再安装依赖Q?/p>

sudo yum install git patch gcc-c++ readline-devel zlib-devel libffi-devel openssl-devel make autoconf automake libtool bison libxml2-devel libxslt-devel libyaml-devel git python python-docutils 

安装 Ruby 2.0

需要安装Ruby2.0QY件仓库中的Ruby 1.8不支持:

mkdir /tmp/ruby && cd /tmp/ruby curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz cd ruby-2.0.0-p353 ./configure --disable-install-rdoc make sudo make install 

安装Bundler GemQ?/p>

sudo gem install bundler --no-ri --no-rdoc 

配置gitlab-shell

创徏git用户Q?/p>

sudo adduser --system --create-home --comment 'GitLab' git   

配置gitlab-shell

su - git -c "git clone https://github.com/gitlabhq/gitlab-shell.git"   su - git -c "cd gitlab-shell && git checkout v1.3.0"   su - git -c "cp gitlab-shell/config.yml.example gitlab-shell/config.yml"   sed -i "s/localhost/gitlab.51yip.com/g" /home/git/gitlab-shell/config.yml   su - git -c "gitlab-shell/bin/install"   chmod 600 /home/git/.ssh/authorized_keys   chmod 700 /home/git/.ssh 

数据?/h2>

GitLab支持 MySQL ?PostgreSQL 数据库。下面以 MySQLZQ介l安装方法:

Debian/Ubuntu下用如下命令安装:

sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev 

Centos下用如下命令:

sudo yum install mysql-server  sudo chkconfig mysqld on 

配置MySQLQ?/p>

sudo echo "CREATE DATABASE IF NOT EXISTS gitlabhq_production DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';" | mysql -u root  sudo echo "UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root'; FLUSH PRIVILEGES;" | mysql -u root  

注意Q用你的密码替换123456?/p>

安装配置 gitlab

su - git -c "git clone https://github.com/gitlabhq/gitlabhq.git gitlab"   su - git -c "cd gitlab;git checkout 5-1-stable"   su git -c "cp config/gitlab.yml.example config/gitlab.yml"   su git -c "mkdir /home/git/gitlab-satellites"   su git -c "mkdir public/uploads"   su git -c "mkdir -p tmp/sockets/"   su git -c "mkdir -p tmp/pids/"   sed -i "s/ host: localhost/ host: gitlab.segmentfault.com/g" config/gitlab.yml   sed -i "s/from: gitlab@localhost/from: gitlab@gitlab.segmentfault.com/g" config/gitlab.yml   su git -c "cp config/puma.rb.example config/puma.rb"   su git -c 'git config --global user.name "GitLab"'   su git -c 'git config --global user.email "gitlab@gitlab.segmentfault.com"' 

注意?code style="box-sizing: border-box; font-family: Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.92857em; padding: 2px 4px; color: #c7254e; border-radius: 3px; background-color: #f6f6f6;">gitlab.segmentfault.com替换Z自己的内宏V?/p>

配置数据库连接:

sudo su git -c "cp config/database.yml.mysql config/database.yml" sudo sed -i "s/secure password/mysql的root密码/g" config/database.yml 

安装MySQL需要的Gems

sudo -u git -H bundle install --deployment --without development test postgres aws 

初始化:

sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab sudo update-rc.d gitlab defaults 21 

查看是否配置妥当Q?/p>

sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production 

重启GitLabQ?/p>

sudo service gitlab start 

配置Nginx

Debian/Ubuntu下:

sudo apt-get install -y nginx 

CentOS下:

sudo yum install nginx 

下蝲配置文g样例Q?/p>

sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab 

修改 /etc/nginx/sites-available/gitlabQ特别留意将 YOUR_SERVER_FQDN Ҏ自己的?/p>

重启nginx:

sudo service nginx restart 

好了Q你可以dGitLab了,默认安装后的用户名:admin@local.hostQ密?code style="box-sizing: border-box; font-family: Consolas, Menlo, Monaco, 'Courier New', monospace; font-size: 0.92857em; padding: 2px 4px; color: #c7254e; border-radius: 3px; background-color: #f6f6f6;">5iveL!fe?/p>



]]>我的 Git 偏好a定http://www.aygfsteel.com/xiaomage234/archive/2014/12/24/421773.html马?/dc:creator>马?/author>Wed, 24 Dec 2014 07:07:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2014/12/24/421773.htmlhttp://www.aygfsteel.com/xiaomage234/comments/421773.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2014/12/24/421773.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/421773.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/421773.html1. ?Command Line 指o列顯C目前處在哪一?Git Branch 分支Q最早是?nbsp;RGBA 看到這一招,非常方便。另外我最q看C個點子是示從上一?commit 之後過了多久時間Q這可以提醒你是不是該 commit ?XD

請修改家目錄?~/.bash_profile 檔案 (我是?Bash)?/p>

1234567891011121314151617
function git_branch {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return;
echo "("${ref#refs/heads/}") ";
}
 
function git_since_last_commit {
now=`date +%s`;
last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return;
seconds_since_last_commit=$((now-last_commit));
minutes_since_last_commit=$((seconds_since_last_commit/60));
hours_since_last_commit=$((minutes_since_last_commit/60));
minutes_since_last_commit=$((minutes_since_last_commit%60));
echo "${hours_since_last_commit}h${minutes_since_last_commit}m ";
}
 
PS1="[\[\033[1;32m\]\w\[\033[0m\]] \[\033[0m\]\[\033[1;36m\]\$(git_branch)\[\033[0;33m\]\$(git_since_last_commit)\[\033[0m\]$ "
view rawgistfile1.txt hosted with ?by GitHub

i果如下Q各位可以看到目前處?master 分支Q並?a style="box-sizing: border-box; color: #bc360a; text-decoration: none;">這個專?/a>已經過了 1821 個小時沒?commit ?#8230;. :p

2. 安裝 Git ?Bash autocompletionQ這樣?tab 會有自動完成的效果Q它甚至包括 git checkout 時都可以抓到你的 branch 名稱。這裡我用 Homebrew 來安?bash-completionQ這套件其實包括很?autocompletion scriptQ你可以?/usr/local/etc/bash_completion.d 這個目錄找扄?/p>

brew install bash-completion cp /usr/local/etc/bash_completion.d/git-completion.bash ~/.git-bash-completion.sh 

R輯 ~/.bash_profile 加入

[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh 

3. 打開 Git ?color 色a定Q這樣 Git 指o的出結果才會加上顏Ԍ像是 git status {:

git config --global color.ui true 

4. a定你偏好的文字R輯器和 diff 工具

git config --global core.editor git config --global merge.tool opendiff 

5. 最後,我個h喜歡以下?aliasQ?/p>

git config --global alias.co checkout git config --global alias.ci commit git config --global alias.st status git config --global alias.br branch 

這樣只要輸入 git st 是 git status 了?/p>

FYIQ以?git a定檔的位置?~/.gitconfigQ你也可以直接修攚w個檔案?/p>

]]>
CentOS 6.5下Git服务器搭?/title><link>http://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421560.html</link><dc:creator>马?/dc:creator><author>马?/author><pubDate>Fri, 19 Dec 2014 02:40:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421560.html</guid><wfw:comment>http://www.aygfsteel.com/xiaomage234/comments/421560.html</wfw:comment><comments>http://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421560.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaomage234/comments/commentRss/421560.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaomage234/services/trackbacks/421560.html</trackback:ping><description><![CDATA[     摘要: 旉:2014-04-14 11:49来源:blog.51cto.com 作?“游响云停” 博客 举报 点击:6031? 关于版本控制版本控制是一U记录一个或若干文g内容变化Q以便将来查阅特定版本修订情늚pȝ。有以下三种版本控制pȝQ?. 本地版本控制pȝ许多Z惯用复制整个目目录的方式来保存不同的版本,或许q会改名加上备䆾旉以示区别...  <a href='http://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421560.html'>阅读全文</a><img src ="http://www.aygfsteel.com/xiaomage234/aggbug/421560.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaomage234/" target="_blank">马?/a> 2014-12-19 10:40 <a href="http://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421560.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>git在windows上配|ssh公钥http://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421559.html马?/dc:creator>马?/author>Fri, 19 Dec 2014 02:39:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421559.htmlhttp://www.aygfsteel.com/xiaomage234/comments/421559.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2014/12/19/421559.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/421559.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/421559.html

2013-05-18 10:02:31     我来说两?nbsp;      作者:沉睡一千年
收藏    我要投稿
git在windows上配|ssh公钥
 
一 .讄git的user name和emailQ?/div>
 
$ git config --global user.name "lxyz"
 
$ git config --global user.email "1129103472@qq.com"
 
?生成密钥
 
ssh-keygen -t rsa -C “1129103472@qq.com”
 
 ?个回车,密码为空?不要输密?
 
然后?ssh下面id_rsa.pub里的内容复制出来_脓到github个h中心的̎戯|的ssh key里面
 
git for windows下蝲地址Q?/div>
 
http://code.google.com/p/msysgit/downloads/list


]]>
svn qo目录http://www.aygfsteel.com/xiaomage234/archive/2011/11/15/363800.html马?/dc:creator>马?/author>Tue, 15 Nov 2011 03:22:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2011/11/15/363800.htmlhttp://www.aygfsteel.com/xiaomage234/comments/363800.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2011/11/15/363800.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/363800.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/363800.htmlsvn propedit svn:ignore 【dir name?/div>

]]>
svn: Unrecognized URL scheme[已经解决Q问题分析] [转]http://www.aygfsteel.com/xiaomage234/archive/2009/04/17/266130.html马?/dc:creator>马?/author>Fri, 17 Apr 2009 04:59:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2009/04/17/266130.htmlhttp://www.aygfsteel.com/xiaomage234/comments/266130.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2009/04/17/266130.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/266130.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/266130.htmlfrom : http://bbs.iusesvn.com/thread-801-1-1.html

svn: Unrecognized URL scheme[已经解决Q问题分析]

我在执行 SVN CO HTTPQ?/ 的时候,出现?span class="t_tag" onclick="tagshow(event)" href="tag.php?name=svn">svn: Unrecognized URL scheme的错误:Q?

首先Q大家可以在SVN 官方的FAQ的翻译中扑ֈ如下问题说明

Subversion 使用外掛pȝ來存取檔案n. 目前有三個這樣的外? ra_local 可以存取本地檔案? ra_dav 可以透過 WebDAV 存取檔案? ?ra_svn 可以透過 svnserve 伺服器來進行本地或遠端的存取. 當你惌?Subversion 進行一個作業時, 用戶端會試著?URL schema 動態載入一個外? file:// URL 會試著載?ra_local, ?http:// URL 會試著?ra_dav, 以此推.

你看到的這個錯? 表示動態連結?載入器無法找到要載入的外? 這個發生的原因, 通常是因Z以共享程式n的方式編?Subversion, 但是還沒有執?make install p埯? 另一個可能就是你埯?make install, 但是E式庫把它存在動態連結?載入器不認得的地? ?Linux ? 你可以把那個程式n目錄加?/etc/ld.so.conf, 然後埯 ldconfig, 讓連結?載入器可以找到程式n. 如果你不想這麼? 或是你沒?root 存取Ɗ限, 你可以在 LD_LIBRARY_PATH 環境變數指定該程式n目錄.

其次Q我们可以执行一下SVNQ看看ra_dav 是否加蝲

svnQ版?1.4.0 (r21228)
~译?Jan  5 2007Q?6:31:46

Copyright (C) 2000-2006 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

可用以下的档案库存?(RA) 模块Q?br />
* ra_svn : 使用svn|络协议讉K档案库的模块?br />   - handles 'svn' scheme
* ra_local : 讉K本地盘的档案库模块?br />
发现我确实没有加载ra_dav q个模块Q不q按照上面的提示解决办法Q我已经?/etc/ld.so.conf 中增界了 /usr/local/svn/lib q个目录Qƈ且重新陨星了 ldconfg 但似乎这栯是加载不q去Q,

接着Q我们发现那个模块ƈ没有加蝲Q经q查看configure 的过E,我们发现我们需要安装一个NEON?span class="t_tag" onclick="tagshow(event)" href="tag.php?name=%E6%8F%92%E4%BB%B6">插g

一定要下蝲 0.25.5 的,最新版本的不能?br />
然后把下载下来的东西QCOPY ?SVN的安装目录,q里C一定要把NEON 的目录名字,?neon.1.25.5 Ҏ neon 不然SVNq是不会认的。?br />
NEON 下蝲地址Q?http://www.webdav.org/neon/

最后,发现问题解决

svn, version 1.4.2 (r22196)
   compiled Jan 11 2007, 12:10:11

Copyright (C) 2000-2006 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_dav : Module for accessing a repository via WebDAV (DeltaV) protocol.
  - handles 'http' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme


希望大家见问题Q解决以后多多交,Q?Q?/div>

]]>subversion分支介绍http://www.aygfsteel.com/xiaomage234/archive/2009/03/04/257740.html马?/dc:creator>马?/author>Wed, 04 Mar 2009 03:38:00 GMThttp://www.aygfsteel.com/xiaomage234/archive/2009/03/04/257740.htmlhttp://www.aygfsteel.com/xiaomage234/comments/257740.htmlhttp://www.aygfsteel.com/xiaomage234/archive/2009/03/04/257740.html#Feedback0http://www.aygfsteel.com/xiaomage234/comments/commentRss/257740.htmlhttp://www.aygfsteel.com/xiaomage234/services/trackbacks/257740.html 的介l?如果你非常熟悉了,也能很好的让你看看Subversion是如何实现这些功能的.
分支是版本控制的一基本的功能.如果你将要用Subversion来管理你的数?q是一个特色你最l依?br /> ?q章要求你已l对Subversion的基本概忉|较熟?

什么是分支?
假设你需要在你的电脑上维护一份被分离的文?一个手册或是别的什?某天要求你对同䆾文档做一个不?br /> 的修改分?但分d他们两者只有一部分不?因此只有d的不?
你将怎么解决q种处境?显而易见的Ҏ是不?可以再拷贝这份文?然后保存两个不同的分ȝ?当某?br /> 部分要进行修Ҏ,只要写入对应的文件就可以?
l常需要对两个拯版本q行同样的修?例如:如果发现一个打印错误在W一个文仉,q也很可能存在第?br /> 个拷贝文仉.q两个文件是相同的的.
q就是分支的基本概念,一条基于另外一条开发线存在的分?q共享在分离之前的日?一个分支就象一个拷
贝的存在,q从那里d,q具有自q历史.
?Figur 4.1. Branches of development
Subversion提供了一些功能来保持文g或目录分支的q?允许通过拯数据来创建分?q记录与源文?br /> 的关p?也能帮助你将一个分支的修改复制到另外其他的支流?ȝ来说,能够映射Z同的工作拯.q样
可以在不同的分支上q行工作.

使用分支
?Figure 4.2. Starting repository layout
假设Sally与你同时拥有"calc"目的工作副?q?calc/trunk的工作副?所有项目相关的文g?br /> ?calc目录?因ؓ你们的团队已l商?calc/trunk用于存放开发主U?
此时你被要求完成一个Q务就是新增项目的一个基本新Ҏ?q将需要很长的旉来完?q可能回影响到项
目中的大部分晚间.问题是你不想与Sally有Q何冲H?Ҏ在修攚w目中的一些存在的BUG.q依赖于最新发
布的目版本,q里(/calc/trunk)ȝ版本是最有效?如果你提交修攚w么肯定会打ؕSally的修改工?
一U策略就是进入一个空z?你和Sally在一C周内停止׃n信息.那就是开始获取整在你工作副本的所?br /> 文g,q不做Q何提交一直到你完成工作Q?q个Ҏ存在着很多问题,W一,q样一来做不安?很多人喜?br /> 频繁的将工作l果上传到版本库,已防止工作副本被H发事g破坏引v的后?W二,不够Ҏ.如果你在不同
的机器上工作,你就需要手工的工作副本进行拷贝修?最?当你完成你的所有修改后,你将发现很难你
的工作合q到ȝ目的代码中?
更好的解x法就是创,建所有你自己的分?能频J的提交工作在不与其他h的冲H下.也能有选择性的׃n
信息.

创徏一个分?br /> 创徏一个分支非常简?只需要用svn copy命o拯目可?Subversion不单支持单文?也支持整个文?br /> 目录的分支创?在此例中,我们要拷?calc/trunk文g?那么应该把拷贝放在那里呢?M地方你想要放|?br /> 的地?q里需要提到项目的{略在库中有/calc/branches目录I间,q你惌拯的目录名重命名ؓmy-
calc-branch.
有两U不同的Ҏ来进行拷?首先介绍有些ȝ的方?只是Z让概忉|C?首先,出版本库./calc.
使用svn copy命o拯要进行分支的文g目录.
$ cd bigwc
$ svn copy trunk branches/my-calc-branch
$ svn status
A  +   branches/my-calc-branch
在这个例自立,拯命o递归拯trunk下的文g到新的工作目?branches/my-calc-branch.你可以从svn
status 命o,心得目录被添加版本库?同时注意"+"W号前面的字母A.他表明添加的列表是一些数据的拯,
q不是新d的版本库的数?当年提交修改?版本库就会创?calc/branches/my-calc-branch在版本库?br /> 通过拯/calc/trunk,而不是通过工作副本数据传送到版本?
$ svn commit -m "Creating a private branch of /calc/trunk."
Adding         branches/my-calc-branch
Committed revision 341.
现在介绍一U简单的创徏分支的方?那就是可以通过lsvn copy 命o传入两个URL路径来实?
$ svn copy http://svn.example.com/repos/calc/trunk \
           http://svn.example.com/repos/calc/branches/my-calc-branch \
      -m "Creating a private branch of /calc/trunk."
Committed revision 341.
从版本库的角度来?实际上这两种Ҏq无M区别.注意区别只在与本地客L,后者可以立x行分支Q
??q不需要你出庞大的工作副本.q种Ҏ是最常用?
?4.3. Repository with new copy

廉h的拷?br /> Subversion的库l过特别的设?当你拯一个文件目录是,你不需要担心会占用大量的版本库定w-实际上版
本库q不会真正的拯数据.取而代之的是徏立一个新的目录\口来指向已存在的目录?如果你是UNIX的用
?q与盘q接的概忉|相同?后面Ҏ件或是目录的修改也是影响被拷贝文件目?M能够使用该概?br /> 的地方Subversion都会利用该理?
q也是ؓ什么听到廉h贝这个词.我们不需要担心文件目录有多大-拯的花贚w是非常微的.q种Ҏ也
是每ơ提交所做的?每个版本都是一ơ廉h?除了很少的一点修Ҏ据进行保?
当然,q些机制或数据共享对于用户都是隐藏不可见?我们能简单的看到拯目录.主要点就是拷贝是非常?br /> L,无论是时间还是空?如果你用q种Ҏ拯是非常快?当然可以随心所Ʋ的q行分支.

使用分支q行工作
现在我们建立了项目的一个䆾?我们可以检分支q开始工作用它.
$ svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch
A  my-calc-branch/Makefile
A  my-calc-branch/integer.c
A  my-calc-branch/button.c
Checked out revision 341.
q个工作副本q无M特别之处;只是单镜像了一个库中项?当你提交修改?Sallyq不期望当她更新?br /> 作副本的时候看到这些修?因ؓ她的工作副本?calc/trunk.
让我们假讄看一个星期里所发生的事
      You make a change to /calc/branches/my-calc-branch/button.c, which creates revision 342.
      You make a change to /calc/branches/my-calc-branch/integer.c, which creates revision 343.
      Sally makes a change to /calc/trunk/integer.c, which creates revision 344.
现在q里有两条独立的开发线
图Figure 4.4. The branching of one file's history

分支背后的关键概?br /> q里有两炚w要的内容需要在q里C.W一,Subversionq没有冲H分支的概念-它只知道怎么去进行拷?
当你拯一个目录是,l果是目录是一个独立的分支.你可能回惛_一个不同的目录被徏立或被处?但对?br /> Subversion只是q_的目录控制区别只是再扩展一个历史日志信?W二,因ؓq种拯机制,Subversion的分
支只是^常的存储在版本库?而不像其他的版本控制pȝ,分支是真正存储了目录文g.
注意,Subversionq不支持不同版本库之间拷贝也使用映射机制,所以他只能在同版本库下工作.

]]>
svn如何换一个用L?/title><link>http://www.aygfsteel.com/xiaomage234/archive/2008/08/21/223400.html</link><dc:creator>马?/dc:creator><author>马?/author><pubDate>Thu, 21 Aug 2008 02:25:00 GMT</pubDate><guid>http://www.aygfsteel.com/xiaomage234/archive/2008/08/21/223400.html</guid><wfw:comment>http://www.aygfsteel.com/xiaomage234/comments/223400.html</wfw:comment><comments>http://www.aygfsteel.com/xiaomage234/archive/2008/08/21/223400.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/xiaomage234/comments/commentRss/223400.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/xiaomage234/services/trackbacks/223400.html</trackback:ping><description><![CDATA[因ؓW一ơ登录ƈ保存密码之后Q会~存到本圎ͼ所以要删除q么一个缓存文件?br /> 地址是: %APPDATA%\Subversion\auth\svn.simple <img src ="http://www.aygfsteel.com/xiaomage234/aggbug/223400.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/xiaomage234/" target="_blank">马?/a> 2008-08-21 10:25 <a href="http://www.aygfsteel.com/xiaomage234/archive/2008/08/21/223400.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ξ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank">ν</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">ء</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">կ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ˮ</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">¡</a>| <a href="http://" target="_blank">̷</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">¬</a>| <a href="http://" target="_blank">ؿ˹</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">˼</a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank">п</a>| <a href="http://" target="_blank">³</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ʡ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ӳ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>