zoukankan      html  css  js  c++  java
  • git常用命令

    一、记录下个人git常用命令

    # 初始化全局信息
    git config --global user.name "Your Name"
    git config --global user.email "email@example.com"
    
    # 生成ssh密钥
    ssh-keygen -t rsa -C "email@example.com"
    
    # 关联远程仓库
    一、直接绑定本地已有仓库
        a、绑定远程仓库到本地仓库,命名为origin
            git remote add origin git@github.com:GitHubMoy25/moy-demo.git
        b、拉取远程仓库(origin)的master分支到本地当前分支
            git pull origin master --allow-unrelated-histories
        c、推送本地当前分支到远程仓库(origin)的master(-u 参数绑定本地分支和远程master关系)
            git push -u origin master
    二、直接复制远程仓库,自动绑定本地仓库和远程
        git clone git@github.com:GitHubMoy25/moy-demo.git
            
    # 设置查看日志别名
    git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%
    d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
    
    # 查看所有分支,前面带remotes/origin 的,是远程分支
    git branch -a
    #查看本地仓库和远程仓库对应关系
    git branch -vv
    
    # 从远程仓库拷贝仓库,并下载远程的develop分支
    git clone ssh://user@host/path/to/repo.git
    git checkout -b develop origin/develop
    
    # 开发新功能时从develop分支拉取新功能分支
    git checkout -b some-feature develop
    # 建立关联,将本地新建的分支推送到远程分支
    git push -u origin some-feature
    
    # 删除功能分支
    git branch -d some-feature
    # 删除远程功能分支
    git push origin :some-feature
    
    # 测试发版
    1、新建分支
    git checkout -b release-0.1 develop
    2、推送到远程分支
    git push -u origin release-0.1
    3、发版测试完成后,合并功能分支到master和develop分支上
    git checkout master
    git merge release-0.1
    git push origin master
    git checkout develop
    git merge release-0.1
    git push origin develop
    # 添加标签,并推送标签到远程
    git tag -a V1.0.0 -m "Initial public release" master
    git push origin --tags
    # 删除本地和远程标签
    git push origin :refs/tags/V1.0.0

    yexiangyang

    moyyexy@gmail.com


  • 相关阅读:
    【转】CUDA5/CentOS6.4
    【转】centos 6.4 samba 安装配置
    【转】Install MATLAB 2013a on CentOS 6.4 x64 with mode silent
    【转】Getting xrdp to work on CentOS 6.4
    【VLFeat】使用matlab版本计算HOG
    Unofficial Windows Binaries for Python Extension Packages
    March 06th, 2018 Week 10th Tuesday
    March 05th, 2018 Week 10th Monday
    March 04th, 2018 Week 10th Sunday
    March 03rd, 2018 Week 9th Saturday
  • 原文地址:https://www.cnblogs.com/moy25/p/9698875.html
Copyright © 2011-2022 走看看