Coder Social home page Coder Social logo

usegithub's Introduction

typora-copy-images-to
media

Github的使用

Connecting to GitHub with SSH

https://help.github.com/articles/testing-your-ssh-connection/

设置账号和EMail

  • 本地设置
$ git config user.name "John Doe"
$ git config user.email [email protected]

本地设置的账号和密码存储在 .git/config中

  • 全局设置
$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

全局设置的账号和密码存储在系统目录中

新建一个仓储

  • 服务端新建一个仓储

    1510909196118

  • 本地初始化git

    • 一般git目录会有三个文件

      1510909215181

    • 初始化的命令

      // 初始化.git文件夹
      git init
      // 文件添加到暂存区
      git add .
      // 提交到本地仓储
      git commit -m 'init'
      // 设置origin
      git remote add origin '[email protected]:goddlts/usegithub.git'
      // 提交到服务器的仓储的master分支
      git push origin master

代码版本还原

  • 查看所有版本
$ git log
  • 还原到指定版本
$ git reset --hard 1cce3c1e6e20ffc86e5fb2b7d5

分支操作

查看当前分支
	$ git branch 
新建分支
	$ git branch dev
切换分支
	$ git checkout dev
合并分支(当前分支是master,把dev合并到master)
	$ git merge dev
新建和切换分支
	$ git checkout -b dev  
	相当于两条命令
	$ git branch dev
	$ git checkout dev
删除分支
	$ git branch -d dev

常用操作

  • clone

从服务器克隆代码

git clone https://github.com/xxx
  • pull

获取最新代码

git pull

Github Pages!

  • 新建一个仓储,名字必须指定为 username.github.io

    • 例如:goddlts.github.io
  • 上传一个静态页面即可

  • 在仓储的设置中

    1510911690628

  • 然后在当前仓储中放置一个index.html既可以通过username.github.io/仓储名称 访问

    • 例如:goddlts.github.io/usegithub

usegithub's People

Contributors

goddlts avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.