关于git的简单使用
2017-07-06 15:28
211 查看
1.github上注册个账号。
2.本地安装了git之后,在项目文件夹(选文件夹右键点击git bash)下:
3.$ ssh-keygen -t rsa -C
"youremail@example.com"
*****创建自己的gitSSH Key公钥
4.将公钥加进自己账户setting中的ssh key
5.初始化本地仓库:git init
6.$ git remote add origin
git@github.com:YourGithubName/demo.git
*****把一个已有的本地仓库与之关联。
7.添加内容进暂存区:git add filename 或者git add *(全部拖进去)
8.提交:git commit -m “修改的说明”
9.$ git push -u origin master 第一次要加-u,因为仓库是空的
10.$ git push origin master 第二次开始直接用这句就可以了 查看该仓库状态:git
status
查看修改内容:git diff
$ git reset --hard HEAD^ 上一个版本
$ git reset --hard 3628164
HEAD指向的版本就是当前版本,因此,Git允许我们在版本的历史之间穿梭,使用命令git reset --hard
commit_id。
穿梭前,用git
log可以查看提交历史,以便确定要回退到哪个版本。
要重返未来,用git
reflog查看命令历史,以便确定要回到未来的哪个版本。
遇到下面情况时
******
error: failed to push some refs to
'git@github.com:AlanKnightly/sum.git'
hint: Updates were rejected because the remote contains work that
you do
hint: not have locally. This is usually caused by another
repository pushing
hint: to the same ref. You may want to first integrate the remote
changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for
details.
******
git branch --set-upstream-to=origin/ master实际上就是:
git branch --set-upstream-to=origin/master master
git pull
2.本地安装了git之后,在项目文件夹(选文件夹右键点击git bash)下:
3.$ ssh-keygen -t rsa -C
"youremail@example.com"
*****创建自己的gitSSH Key公钥
4.将公钥加进自己账户setting中的ssh key
5.初始化本地仓库:git init
6.$ git remote add origin
git@github.com:YourGithubName/demo.git
*****把一个已有的本地仓库与之关联。
7.添加内容进暂存区:git add filename 或者git add *(全部拖进去)
8.提交:git commit -m “修改的说明”
9.$ git push -u origin master 第一次要加-u,因为仓库是空的
10.$ git push origin master 第二次开始直接用这句就可以了 查看该仓库状态:git
status
查看修改内容:git diff
$ git reset --hard HEAD^ 上一个版本
$ git reset --hard 3628164
HEAD指向的版本就是当前版本,因此,Git允许我们在版本的历史之间穿梭,使用命令git reset --hard
commit_id。
穿梭前,用git
log可以查看提交历史,以便确定要回退到哪个版本。
要重返未来,用git
reflog查看命令历史,以便确定要回到未来的哪个版本。
遇到下面情况时
******
error: failed to push some refs to
'git@github.com:AlanKnightly/sum.git'
hint: Updates were rejected because the remote contains work that
you do
hint: not have locally. This is usually caused by another
repository pushing
hint: to the same ref. You may want to first integrate the remote
changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for
details.
******
git branch --set-upstream-to=origin/ master实际上就是:
git branch --set-upstream-to=origin/master master
git pull
相关文章推荐
- 关于idea使用git的简单说明
- 关于java -classpath 命令的简单使用
- 关于使用TreeView 控件的简单介绍
- git 简单命令使用
- 关于进度条的简单的使用方法
- GIT 简单使用
- 关于MYSQL的可视化工具Navicat for MySQL 的简单使用
- Ubuntu下git简单使用
- 关于使用PRO*C编程的一些简单说明和例子
- 关于LoadRunner使用的简单小例子
- 关于使用PRO*C编程的一些简单说明和例子
- 关于使用PRO*C编程的一些简单说明和例子
- 关于使用Spring和hibernate开发web程序的配置说明和简单实例的详细说明
- 关于类似于电信弹出广告(push业务),使用ROS与简单web服务器实现
- 关于MSChart的简单学习与使用
- 关于存储过程中一个参数表示多个查询条件使用方法的简单处理
- 版本控制工具git的简单使用
- 关于使用PRO*C编程的一些简单说明和例子
- 今天写的一段代码关于泛型的简单使用
- 简单使用Git