GitHub学习笔记
msysgit是Windows版的Git,从http://msysgit.github.io/下载,然后按默认选项安装即可。安装完成后,在开始菜单里找到”Git”|”Git Bash”,蹦出一个类似命令行窗口的东西,就说明Git安装成功!
git config --global user.name "YOUR NAME" git config --global user.email "YOUR EMAIL ADDRESS"
注意git config命令的--global参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。
选择仓库是公开的还是私有的(只允许付费用户创建)。 选择”Initialize this repository with a README.”。 点击”Create repository”。
也可从命令行输入如下语句:
mkdir repoName
cd repoName
git init
在仓库的文件列表点击”README.md”。 点击编辑按钮,对文件作出修改,文件内容上方有预览按钮可以预览修改效果。 在”Commit changges”下方输入简单的有意义的更新信息。 点击”Commit changes”。
最后一步除了”Commit changes”之外还有” Create a new branch for this commit and start a pull request”选项,可以用此选项创建一个pull request。管理员即可点击”Merge pull request”合并结果。如果从命令行合并,步骤如下:
Step 1: From your project repository, bring in the changes and test.
git fetch origin
git checkout -b chinaeagle001-patch-1 origin/chinaeagle001-patch-1
git merge master
Step 2: Merge the changes and update on GitHub.
git checkout master
git merge --no-ff chinaeagle001-patch-1
git push origin master
On GitHub, navigate to the octocat/Spoon-Knife repository. Fork buttonIn the top-right corner of the page, click Fork.
在GitHub页面,导航到你的分支,复制分支的URL。 打开命令行,输入:git clone https://github.com/YOUR-USERNAME/Spoon-Knife。 回车,本地克隆创建完毕。 配置Git使分支与原始的仓库同步
On GitHub, navigate to the octocat/Spoon-Knife repository. 复制原始仓库的URL。
在命令行输入git remote -v并点击回车,可以看到当前配置的你的分支的远程仓库。
git remote -v
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
输入git remote add upstream,然后粘贴复制的URL并点击回车。
git remote add upstream https://github.com/octocat/Spoon-Knife.git
git remote -v
# origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
# origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
# upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
# upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
现在,就可以通过少量的Git命令使分支与原始仓库同步。
git fetch upstream
git checkout master
git merge upstream/master
The sky’s the limit with the changes you can make to a fork, including:
- Creating branches: Branches allow you to build new features or test out ideas without putting your main project at risk.
- Opening pull requests: If you are hoping to contribute back to the original repository, you can send a request to the original author to pull your fork into their repository by submitting a pull request.
Github全面学习笔记 不如看看官方的指导手册:https://guides.github.com/ 可以翻译成中文查看哦! ====================================================如何创建分支branch? 分支可以方便同时处理多个版本的代码,它是在创建分支的那个时间点上的原始分支的精确副本。
相关文章
- CDN:jsDelivr + Github
- 【学习笔记】Git&Github的基本使用
- 阿里巴巴全新SpringCloud实战笔记(全彩版)GitHub狂揽70000标星
- 恨啊!网易架构师500页趣谈网络笔记遭助手泄露,GitHub人手一份
- 前方高能!阿里P8撰写的30W字TCP/IP协议进阶笔记:GitHub标星96k
- GitHub用户注意,网络钓鱼活动冒充CircleCI窃取凭证
- Git 上传项目至 Github 超简单方法!
- 掌握编写有效的GitHub提交信息的艺术
- Github Actions Hexo 自动部署
- 2022 如何在 GitHub 上搭建个人网站(github.io)
- 开源程序员愤怒控诉!Github的「AI码农」Copilot就是寄生虫
- GitHub 又一可视化低代码神器,诞生了!
- GitHub 又一黑科技项目诞生,成功复现 ChatGPT 完整流程!
- 【OpenGL】三、Visual Studio 2019 配置 GitHub ( 将项目上传到 GitHub )
- LLaMA模型惨遭泄漏,Meta版ChatGPT被迫「开源」!GitHub斩获8k星,评测大量出炉
- 斯坦福科学家开源了莫德纳mRNA新冠疫苗的基因测序,在GitHub上
- 如何设计 QQ、微信、微博、Github 等第三方账号登陆 ?(附表设计)
- Github Actions实现项目的CI/CD
- Typecho 仿Github回复
- 爱了!Alibaba技术官甩出的SpringCloud笔记,GitHub已标星81.6k
- githubOracle11 OCI技术在GitHub上的应用(oracle11oci)
- Github Atom简史:差点被GitHub创始人放弃
- 百度统计js被劫持用来DDOS Github
- Python 为什么要迁移到 Github
- GitHub 为什么选择了 Kubernetes ?
- Grank:如何评估一个 Github 项目的活跃度