zoukankan      html  css  js  c++  java
  • git使用说明

    git使用说明

    配置git的环境变量

    # set git variables 
    git config --global user.name "<your name>"
    git config --global user.email "name@email.com"
    
    # query the value of user.name
    get config user.name
    

    复制一个Repository到客户端

    git clone https://github.com/apache/spark.git
    cd spark
    

    创建一个Repository

    # create git repository on the client
    mkdir myRepos
    cd myRepos
    git init
    

    增加一个文件

    # create a file
    touch README.md
    
    # add the file into the client repository
    git add README.md
    
    # record changes to the client repository
    git commit -m "my changes"
    
    # add a remote
    git remote add origin https://github.com/apache/spark.git
    
    # Deliver client changes to the server repository
    git push -u origin master
    

    Git Workflow

    We are using a simplified version of Gitflow workflow. Here is some information about Gitflow:

    High-level tutorial from Atlassian
    Original blog about Gitflow

    • Here is a transcript showing how to make a change from start to finish using this workflow:
    git remote show origin                  # Check your configuration before starting
    git status                              # Use this command frequently
    git checkout -b new-branch-name develop # Creates a new local branch based on develop
    
    • Now change whatever files you need to, and then make use of some of these commands as your work progresses:
    git add README.md                       # Add your changed files to the staging area
    git diff --staged                       # Compares the staging area to your local repo
    git commit -a                           # Commits changes in staging area to local repo
    git log --name-status --since=2.days    # Make sure the history looks as expected
    git show <hash of your commit>          # View details of your commit
    git diff --name-status new-branch-name develop # View diff between your feature branch and local develop
    git push -u origin new-branch-name      # Pushes whole branch to central repo
    
    • pull request

      • create a pull request
      • have someone review the change
      • then you or someone else can merge it.
    • After the pull request is merged, your local develop branch will be out of date so now update it and verify it:

    git status
    git checkout develop                        # switch to the develop branch
    git remote update                           # collect commits into the local repository
    git merge origin/develop                    # merge changes into the local develop branch
    git log --oneline --since=2.days
    git branch -d new-branch-name               # Optionally delete your feature branch locally
    git push origin --delete new-branch-name    # Optionally delete your feature branch remotely
    
  • 相关阅读:
    Android升级ADT22后会报ClassNotFoundException的原因分析
    修改Android解锁界面
    Android中dip, dp, px,pt, sp之间的区别:
    移动开发:Android官方提供的支持不同屏幕大小的全部方法
    常用正则表达式
    Android多语言与国际化
    Android中的资源与国际化
    Android开发:使用Fragment改造TabActivity
    Android开发–Intent-filter属性详解
    Fragment、Activity比较——Android碎片介绍
  • 原文地址:https://www.cnblogs.com/steven-yang/p/7515268.html
Copyright © 2011-2022 走看看