zoukankan      html  css  js  c++  java
  • 推送现有git到远程服务器并创建新分支

     
     
    yuanwei@huiye:~/cust-repo/7125a-app/device/qcom$ git clone msm7627a test
    Cloning into 'test'...
    done.
    yuanwei@huiye:~/cust-repo/7125a-app/device/qcom$ ls
    common  msm7627a  msm7627a_sku1  msm7627a_sku3  test
    yuanwei@huiye:~/cust-repo/7125a-app/device/qcom$ ls test/
    7k_handset.kl  AndroidBoard.mk     BoardConfig.mk                 init.target.rc  recovery_mmc.fstab  surf_keypad.kl  wpa_supplicant.conf
    7x27a_kp.kcm   Android.mk          egl.cfg                        msm7627a.mk     scripts             system.prop
    7x27a_kp.kl    AndroidProducts.mk  init.qcom.composition_type.sh  recovery.fstab  surf_keypad.kcm     vold.fstab
    
    
    
    推送分支
    
    
    
    #!/bin/bash
    #这是我创建服务器端git的一个脚本非常实用。 
    #  create one project 
    read -p " create one  input dest dir ignore 8x25:" dest
    
    echo "starting .................................."
     
    ssh -p 29418 gerrithost gerrit create-project 7125a/$dest
    cd $1
    git init .
    git branch
    git checkout -b gingerbread-qrd-1098-release-r16 
    git add  .
    git commit -m "add by yuanwei "
    git push git@192.168.10.91:server/7125a/${dest}.git  gingerbread-qrd-1098-release-r16:refs/heads/gingerbread-qrd-1098-release-r16
    cd -
    echo "ending .................................."
    
    查看服务器端分支代码
    
    git@huiye:~/server/7125a/device/qcom/test.git$ git branch
      gingerbread-qrd-1098-release-r16
    git@huiye:~/server/7125a/device/qcom/test.git$ ls
    branches  config  description  HEAD  hooks  logs  objects  refs
    git@huiye:~/server/7125a/device/qcom/test.git$ cat HEAD 
    ref: refs/heads/master
    这个分支并不存 因为我推送的时候直接用的新分支 没有master
    git@huiye:~/server/7125a/device/qcom/test.git$ ls
    branches  config  description  HEAD  hooks  logs  objects  refs
    git@huiye:~/server/7125a/device/qcom/test.git$ ls
    branches  config  description  HEAD  hooks  logs  objects  refs
    git@huiye:~/server/7125a/device/qcom/test.git$ ls
    branches  config  description  HEAD  hooks  logs  objects  refs
    git@huiye:~/server/7125a/device/qcom/test.git$ ls
    branches  config  description  HEAD  hooks  logs  objects  refs
    git@huiye:~/server/7125a/device/qcom/test.git$ vim HEAD 
    修改HEAD 指向我的新分支
    git@huiye:~/server/7125a/device/qcom/test.git$ cat HEAD 
    ref: refs/heads/gingerbread-qrd-1098-release-r16

    如果不修改为红色的分支 则下载后无法checkout

    yuanwei@huiye:~/test$ git clone git@192.168.10.91:server/7125a/device/qcom/test.git
    Cloning into 'test'...
    remote: Counting objects: 233, done.
    remote: Compressing objects: 100% (93/93), done.
    remote: Total 233 (delta 138), reused 233 (delta 138)
    Receiving objects: 100% (233/233), 55.05 KiB, done.
    Resolving deltas: 100% (138/138), done.
    warning: remote HEAD refers to nonexistent ref, unable to checkout.
    


    则会提示无法检出当前分支  远程只有一个分支 没有master 的修改后

    yuanwei@huiye:~/test$ git clone git@192.168.10.91:server/7125a/device/qcom/test.git
    Cloning into 'test'...
    remote: Counting objects: 233, done.
    remote: Compressing objects: 100% (93/93), done.
    remote: Total 233 (delta 138), reused 233 (delta 138)
    Receiving objects: 100% (233/233), 55.05 KiB, done.
    Resolving deltas: 100% (138/138), done.
    yuanwei@huiye:~/test$ ls
    
    再看效果
    yuanwei@huiye:~/test/test$ ls
    7k_handset.kl  AndroidBoard.mk     BoardConfig.mk                 init.target.rc  recovery_mmc.fstab  surf_keypad.kl  wpa_supplicant.conf
    7x27a_kp.kcm   Android.mk          egl.cfg                        msm7627a.mk     scripts             system.prop
    7x27a_kp.kl    AndroidProducts.mk  init.qcom.composition_type.sh  recovery.fstab  surf_keypad.kcm     vold.fstab
    




  • 相关阅读:
    市场规模的估算
    C#中的线程(一)入门 转载
    2.设计模式-Abstract Factory 抽象工厂模式
    1.设计模式
    Microsoft.Jet.OLEDB.4.0读取EXCEL数据
    转载--加盐密码哈希:如何正确使用
    ragel学习资源整合
    开源库xlslib跨平台编译
    WPF开源框架以及经典博客
    (转载)值得推荐的C/C++框架和库 (真的很强大)
  • 原文地址:https://www.cnblogs.com/yuzaipiaofei/p/4124165.html
Copyright © 2011-2022 走看看