git 用法记录,方便以后
2017-09-08 15:38
706 查看
1,$git status查看分支状态2,$ git add .gitignorefatal: pathspec '.gitignore' did not match any files$git add . 添加所有添加到本地仓库3,$ git commit -m "20170908"[master (root-commit) 70642cf] 20170908提交本地并添加相关信息4,$ git checkout -b harrySwitched to a new branch 'harry'切换到其他分支5,$ git pull远程仓库代码拉下来6,$ git push origin master提交到远程服务端7,$ git logcommit 047c868f052fe450da6e38709520c80026b1598cAuthor: nith.hou <nith.hou@t**.com.cn>Date: Tue Sep 5 11:25:41 2017 +0800查看log信息8,$ git reset --hard 3c936aee7b3e00f0086434f7e3bdbb43e54995e5这个命令是恢复到对应版本穿梭前,用
git log可以查看提交历史,以便确定要回退到哪个版本。要重返未来,用
git reflog查看命令历史,以便确定要回到未来的哪个版本。9,查看远程分支使用如下命令可以查看远程仓库(我这里有一个origin仓库)
$ git remote -
v
origin git@github.com:username
/Animations
.git (fetch)
origin git@github.com:username
/Animations
.git (push)
10,fetch更新本地仓库:
$ git fetch origin master:temp //从远程的origin仓库的master分支下载到本地并新建一个分支temp$ git diff temp//比较master分支和temp分支的不同$ git merge temp//合并temp分支到master分支$ git branch -d temp//删除temp
11,$git revert c011eb3c20ba6fb38cc94fe5a8dda366a3990c61revert 使用,需要先找到你想回滚版本唯一的commit标识代码
相关文章推荐
- 记录一些WPF常用样式方便以后复用(二)(Button、CheckBox、输入账号密码框)(转)
- git 实时记录每次提交的内容,方便多人多台机器协同操作
- java 环境变量设置 留个记录方便以后查找
- fwrite和fread用法记录(方便查询)
- android 安全机制验证机制总结(就本人目前的水平进行总结,记录以方便以后提高补充)
- (转)Git Stash用法,方便临时处理bug时随时切换分支而不丢失修改
- [猜你喜欢]冠军 yes,boy! 分享 | 推荐系统也可以很简单 做个记录 以后方便学习
- DES3加解密 记录下来方便以后用
- Dom元素基本操作方法API,先记录下,方便以后使用。 W3C DOM和JavaScript很容易混淆不清。DOM是面向HTML和XML文档的API,为文档提供了结构化表示,并定义了如何通过脚本
- 知识点要做好记录,方便以后自己查阅
- Git Stash用法,方便临时处理bug时随时切换分支而不丢失修改
- 记录一些WPF常用样式方便以后复用
- git add -p用法记录
- Git Stash用法,方便临时处理bug时随时切换分支而不丢失修改
- yii2--配置文件记录,方便以后使用
- .net一些常用功能(记录下,方便以后查询,慢慢完善)
- 记录,方便以后查询rtl8881a,ecos,cmj-1
- eclipse环境安装(为了以后方便记录一下)
- Python个 flask 教程地址 做个记录方便以后学习用
- UI控件效果记录,方便以后使用查询