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
    
  • 相关阅读:
    【Python3爬虫】一次应对JS反调试的记录
    【Python3爬虫】突破反爬之应对前端反调试手段
    学习CSS之如何改变CSS伪元素的样式
    学习CSS之用CSS实现时钟效果
    学习CSS之用CSS绘制一些基本图形
    【Python3爬虫】一次破解JS加密数据的记录
    Linux安装部署Redis(超级详细)
    Linux部署MongoDB
    使用Nginx对.NetCore站点进行反向代理
    Linux部署.NetCore站点 使用Supervisor进行托管部署
  • 原文地址:https://www.cnblogs.com/steven-yang/p/7515268.html
Copyright © 2011-2022 走看看