git和github使用(二)

前端7班_leec

gitcat

forks

当fork一个repo时,实际上是复制了一份repo到自己github账号下。通过fork我们建立了自己所需使用的修改版本。


centralized-github

clone到本地

git clone

并且直接被自动连接到你github账号下的remote repo(fork副本)。通过(git remote add )可以把修改pull到原始的repo。git remote -v检查remote连接。

新增branch

Understanding the GitHub Flow

branch&merge

Github Pages

github会自动发布你放在'gh-pages' branch上的静态页面。并且提供一个URL(fork后,branch名字为'gh-pages')。
1.git branch (branchname格式:add-username),得到一个全新的内容跟'gh-pages一模一样的分支'。
2.git checkout 选择新建分支。
3.修改代码,推送(git add、git commit、git push);
git add -A会将新增和删除操作一起add。
git branch -M 修改分支名字。
git checkout -b 新增並切換到新的分支branch

协作

Collaborators 是被赋予特定repository编辑权限的使用者要新增collaborators,先到repository的GitHub页面,点击Settings->选择 'Collaborators'页面->输入账号->点击add。

pull##

git pull 从remote pull 更新。
git fetch --dry-run更新前检查remote是否有改动。

git pull

pull request 请求更新##

pull request

在原始repo页面下,点击pull request。


new pull request

本地Merge

1.切换到想要merge进去的branch,如:gh-pages:

git checkout gh-pages

2.告诉git 想要合并的分支

git merge

3.删除2中的分支

git branch -d or git push --delete

从upstream pull

git pull upstream gh-pages

本文整理自:git-it

你可能感兴趣的:(git和github使用(二))