github命令学习笔记

1、创建版本库

mkdir test

git init

2、提交代码

git add test.php

git commit -m "this is a comment

3、查看状态

git status

4、与版本库比较文件差异

git diff HEAD – - test.php

5、查看日志

git log

git log – -pertty=oneline

6、退回上一个版本

git reset – -hard HEAD^  (HEAD^^ 上上一个版本,HEAD~100 上100个版本)

7、退回指定一个版本

git reset – -hard id号 (reflog查看版本id号)

8、查看文件内容

cat test.php

9、删除文件

rm test.php

10、撤销修改

git checkout – - test.php

11、创建SSH KEY

ssh-keygen -t rsa -C "你邮箱地址"

12、连接远程库

git remote add testname git@github.com:testuser/test.git

13、把项目推送到远程库

git push -u testname master

14、克隆项目到本地

git clone git@github.com:testuser/test.git

git remote add upstream https://github.com/winterIce/testTitle.git(别人的repository)    // 新建分支用于存放别人的repository

git clone https://github.com/winterIce/testTitle.git  克隆到本地

git fetch branch2//更新信息

git merge branch2/master    //merge本地信息

git add . //添加新文件或者更改新文件

git remove  ** //删除文件

git commit -m 'by who do what'  //提交文件到本地

git push  push到服务器上

git pull origin master 从服务器上拉取信息

git remote  查看repository上的所有分支

git branch -a  查看所有分支

git branch -r 查看远程分支

git branch -d *** //删除分支

git branch *** //新建分支

git checkout ***//切换分支

git status //查看状态

git log //查看提交修改记录

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值