本文共 2553 字,大约阅读时间需要 8 分钟。
sudo apt-get install git
msysgit是Windows版的Git,从下载,然后按默认选项安装即可。安装完成后,在开始菜单里找到”Git”|”Git Bash”,蹦出一个类似命令行窗口的东西,就说明Git安装成功!
打开命令行,输入如下代码:
git config --global user.name "YOUR NAME"git config --global user.email "YOUR EMAIL ADDRESS"
注意git config
命令的--global
参数,用了这个参数,表示你这台机器上所有的Git仓库都会使用这个配置,当然也可以对某个仓库指定不同的用户名和Email地址。
也可从命令行输入如下语句:
mkdir repoName
cd repoName
git init
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
git clone https://github.com/YOUR-USERNAME/Spoon-Knife
。在命令行输入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
,可以看到如下信息: 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.转载地址:http://ozfcx.baihongyu.com/