经常使用git命令集
2024-08-28 08:25:44
//创建本地仓库
mkdir git_root;cd git_root;git init //
//查看
git status .
git log
git log ./kernel/driver/
git show 17228ec1630f6b47983870b3eddc90d4088dcc88 --name-only
//下载
git clone https://github.com/wh19910525/my_often_shell.git
git clone https://github.com/wh19910525/my_often_shell.git
git branch
git branch -a
git checkout branch1 //switch to an local branch
git checkout -t remot_branch2 //download and switch to an remote branch
git checkout /kernel/driver/ //将指定文件夹下的文件还原成server上的内容
//提交
//提交
git add .
git commit -m "this my first commit"
git pull
git push
//恢复改动
git checkout -- hardware/realtek/rtl_8723bs/8723bs.mod.c //discard this files
git reset
//生成补订
git format-patch -1 hash // git format-patch -1 300830d0286bceca191d926bc2cf4d08cc58b813
git diff drivers/idle/intel_idle.c > liuxd_test_patch
git am xx.patch
patch -p1 < test1.patch // a/该文件夹
patch -p2 < test1.patch // a/b/该文件夹
创建分支//new branch
git branch // list
git branch my_new_branch // add a new branch at local
git checkout my_new_branch // switch to local branch
git push origin my_new_branch:my_new_branch
//push to remote server.
//push to remote server.
//
git revert 9ca532610fa179911b23e244c96db10c140639f2 // 取消某次提交
//
git checkout . // 还原(覆盖)本地的改动
//
git cherry-pick 9ca532610fa179911b23e244c96db10c140639f2
//将远程分支相应的补丁打过来。
//将远程分支相应的补丁打过来。
git clean -df //delete全部未跟踪的文件夹及文件
删除分支:
1 删除远程分支
$ git push origin :branchName
2 删除本地分支,强制删除用-D
$ git branch -d branchName
1 删除远程分支
$ git push origin :branchName
2 删除本地分支,强制删除用-D
$ git branch -d branchName
最新文章
- 利用反射完成初级万能DAO
- AIDL简单使用
- 使用Blend的一些问题
- 经典dp 编辑距离
- 平移关节(Prismatic Joint)
- jqurey datatables属性
- Scrapy 入门
- flex布局下overflow失效问题
- The current state of generics in Delphi( 转载)
- centos-7 虚拟机安装图形界面
- BufferReader BufferWriter
- 学习JS的心路历程-参数的传递(下)
- elasticsearch6.0版本安装head插件
- Java Nashorn--Part 3
- 如何用INNO安装添加快捷启动方式到Win7的快速启动栏(超级任务栏)
- ios 工具大全,最全框架
- 【POJ】1740.A New Stone Game
- 设置跨交换机VLAN
- Ajax笔记-加强版
- Heimich manoeuvre 海姆利克氏操作
热门文章
- CodeForces 482C Game with Strings
- W3C DOM 事件模型(简述)
- Android checkbox和radiobutton 以及Toast和AlertDialog的使用
- OpenWrt配置opkg.conf
- 全栈JavaScript路(八)得知 CDATASection 种类 节点
- hdu1023
- IIS 7.0 Features and Vista Editions
- about greenplum collection tool
- Storing and Retrieving Images from SQL Server using Microsoft .NET
- scala 101