git&github

创建版本库

$ mkdir git_trainning  # 创建
$ cd git_trainning
$ pwd

$ git init #  初始化

把文件添加到版本库

  • 第一步,把文件添加到暂存区
$ git add <file>
$ git add .  # 将当前目录下所有改动的文件到代码库

  • 第二步,把暂存区的所有内容提交到当前分支
$ git commit -m "版本说明"

回滚

$ git reset --hard 版本id
$ git reset --hard HEAD^  # 回到上一个版本
# HEAD  代表当前版本
# HEAD^  代表上一个版本
# HEAD^^  代表上两个版本
# HEAD^100 代表上100个版本

撤销和修改

  • 一键还原,将版本库的文件替换工作区文件
git checkout -- <file>  # 丢弃工作区的修改
  • 删除
rm <file>
git rm <file>  # 确认删除
git commit -m <remove ...>  # 确认删除

其他命令

  • 查看暂存区状态
$ git satus
  • 查看历史记录
$ git log

  • 查看命令记录
$ git reflog

github

http://www.cnblogs.com/alex3714/articles/5930846.html

pycharm使用github

http://blog.csdn.net/hk2291976/article/details/51159974

原文地址:https://www.cnblogs.com/Jason-lin/p/8111808.html