GitHub学习三-远程版本库更新与提交

1.远程版本库更新

一般来说,将本地与远程相关联之后,首先将数据从远程更新下来再上传比较好.

输入

git pull origin master

 如果新建版本库的话勾选了初始化包含readme.md,那么会将readme.md更新下来.

2.本地版本库提交

改动的操作先提交到本地版本库,再由本地版本库提交到远程版本库

2.1  设置邮箱和用户名

如果不设置,git commit的时候就会出现

$ git commit

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

输入

$ git config --global user.name zwxbest

$ git config --global user.email zhangweixiao@live.com

 2.2 添加文件到暂存区.

git add AdvancedSpriteEditor.cs

 2.3 提交文件到本地版本库

git commit -m "push new file about slice sprite "

 3.提交本地版本库的更新到远程版本库

git push -u origin master

u是upstream的缩写,

upstream表示的是本地版本库,上流是发生变化的地方

远程版本库,自然就是downstream了.

有时候git push奇慢,没办法,没被Q就已经谢主隆恩了.