GitHub Toturial

GitHub Toturial

Git Summary

1. 设置姓名和email

git config --global user.name "YuboFeng"
git config --global user.email "networkprogramming@yeah.net"

2. 提升命令可读性

git config --global color.ui auto

3. 设置 SSH Key

ssh-keygen -t rsa -C "networkprogramming@yeah.net"

有三处须要用户输入的地方,都按回车便可。git

而后,把 .ssh/id_rsa.pub 文件中的内容所有粘贴到 GitHub 上的 Add SSH Key 便可。github

cat .ssh/id_rsa.pub

4. 查看本地仓库状态

git status

5. 添加至本地仓库

git add new_file

6. 查看提交日志

git log

-p 选项显示文件修改先后的差异bash

7. 提交修改至本地仓库

from 暂存区 to 本地仓库ssh

git commit -m "comments"

8. 更新 GitHub 上的仓库

from 本地仓库 to 远程仓库ui

git push

9. 获取最新的远程仓库分支

git pull origin [brunch-name]

10. 查看更改

提交(commit)以前必须作url

git diff HEAD

11. 添加一个远程仓库

git remote add [name] [url]

Pull Request

Explaning the processing of Pull Request with RaRe-Technologies/gensim..net

step 1. Frok

Frok from the origin日志

step 2. clone

Clone from your Forkcode

step 3. 建立 branch

首先,咱们须要确认分支rem

$ git branch -a
* develop  # develop 为当前分支
  remotes/origin/HEAD -> origin/develop

而后,建立特性分支。咱们建立一个名为 wordsim240-296-297 的分支。

$ git checkout -b wordsim240-296-297 develop
Switched to a new branch 'wordsim240-296-297'  # 当前分支自动被切换
$git branch -a  # 再次确认当前分支
  develop
* wordsim240-296-297
  remotes/origin/HEAD -> origin/develop

对代码仓库进行修改,将修改添加至本地仓库,提交修改:

$ git add .....
$ git commit -m "some editing"

而后,建立远程分支:

$ git push origin wordsim240-296-297
  remotes/origin/HEAD -> origin/develop

再次确认分支

$ git branch -a 
  develop
* wordsim240-296-297  # 分支已被建立
  remotes/origin/HEAD -> origin/develop

step 4. 发送 Pull Request

相关文章
相关标签/搜索