Git使用经验

来源:互联网 发布:淘宝装修如何上传图片 编辑:程序博客网 时间:2024/05/04 10:11

  1. 新建git项目步骤
  • 配置gitosis-admin:

          >git clone

          >vi  gitosis-admin/gitosis.conf

          [group pv_system]

          writable =pvinsight_app 

          members =username

          >git  commit   –am “add project pvinsight_app”

          >git push

  • 本地新建项目(已有git客户端环境):

          >mkdir  pvinsight_app

          >cd  pvinsight_app

          >git  init 

          >git  add  . (新增文件)

          >git  commit   –am “pvinsight_app init project”

          >git  remote  add  origin  

          >git  push origin master

          >……

 

      2.  检查哪些文件被更改


          git log
          ------------------------------------------------------
          commit eed0fba3a0f493a8f21997260e6bc6d7573f08bf
          Author: xxx <xxx@xxx.com>
          Date: Thu Aug 18 15:33:55 2011 +0800


          编号:eed0fba3a0f493a8f21997260e6bc6d7573f08bf
 
          包含有所有更改记录的文件列表
          git diff --name-only eed0fba3a0f493a8f21997260e6bc6d7573f08bf > ./filelist.txt

          查看所有的文件列表
          cat ./filelist.txt
 

      3. 导出zip 归档包


          git  archive  --format  zip  --output    e:\monitor.zip   master  

      

      4. 针对工程打tag


          >git   tag (see  tag)

          >git   tag  -r (see remote tag)

          >git   tag   update-20110826 (create  local  tag)

          >git   push origin refs/tags/update-20110826(create  remote  tag)

          >git   tag -d  update-20110826 (delete  local  tag)

          >git   push origin  :refs/tags/update-20110826(delete  remote  tag)

 

     5. 将A仓库迁移到B仓库

          git  push  ssh://git@xxx.sohu.com/monitor.git   :master

          git  push  ssh://git@xxx.sohu.com/monitor.git   myzookepeer:master

          git  push  ssh://git@xxx.sohu.com/monitor.git   +myzookepeer:master

 

      6. 删除仓库分支

          git branch -D myzookepeer


      7. 修改全局用户名和邮箱
          git config --global user.name "username"
          git config --global user.email "email"

          

 

     参考: http://blog.haohtml.com/archives/10129

0 0