GitHub常用命令

1、设置个人信息

git config --global user.name "xxx"
git config --global user.email "xxx@xxx.xxx"

2、提交

@@初始化本地git
cd hello-git
git init

@@新建README文件
touch README
git add README

@@提交文件到本地Git
git commit -m 'first commit'

@@提交文件到远程Git
git remote add origin git@github.com:username/hello-git.git
git push -u origin master

3、取回

git clone git@github.com:username/Spoon-Knife.git
cd Spoon-Knife

4、Fork

@@产生Fork后取回
git clone git@github.com:username/Spoon-Knife.git
cd Spoon-Knife

@@追加上级代码信息
git remote add upstream git://github.com/SomeOne/Spoon-Knife.git
git fetch upstream
@@合并上级代码
git fetch upstream
git merge upstream/master

5、分支

@@创建分支
git checkout -b mybranch
@@合并分支
git checkout master
git merge mybranch
git branch -d mybranch

Leave a Reply

Your email address will not be published. Required fields are marked *

*