首页 > 代码库 > 常用git commond 锦集
常用git commond 锦集
#查看
git log
git log ./kernel/driver/
git show 17228ec1630f6b47983870b3eddc90d4088dcc88 --name-only
//下载
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/ //将指定目录下的文件还原成服务器上的内容
//提交
git status .
git add .
git checkout -- hardware/realtek/rtl_8723bs/8723bs.mod.c //discard this files
git commit -m "this my first commit"
git push
//生成补订
git format-patch -1 hash // git format-patch -1 300830d0286bceca191d926bc2cf4d08cc58b813
//先检查patch文件:# git apply --stat newpatch.patch
//检查能否应用成功:# git apply --check newpatch.patch
//打补丁:# git am --signoff < newpatch.patch
git am xx.patch
//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.
//
git revert 9ca532610fa179911b23e244c96db10c140639f2 // 取消某次提交
//
git checkout . // 还原(覆盖)本地的修改
//
git cherry-pick 9ca532610fa179911b23e244c96db10c140639f2 //将远程分支对应的补丁打过来。
删除分支:
1 删除远程分支
$ git push origin :branchName
2 删除本地分支,强制删除用-D
$ git branch -d branchName
git log
git log ./kernel/driver/
git show 17228ec1630f6b47983870b3eddc90d4088dcc88 --name-only
//下载
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/ //将指定目录下的文件还原成服务器上的内容
//提交
git status .
git add .
git checkout -- hardware/realtek/rtl_8723bs/8723bs.mod.c //discard this files
git commit -m "this my first commit"
git push
//生成补订
git format-patch -1 hash // git format-patch -1 300830d0286bceca191d926bc2cf4d08cc58b813
//先检查patch文件:# git apply --stat newpatch.patch
//检查能否应用成功:# git apply --check newpatch.patch
//打补丁:# git am --signoff < newpatch.patch
git am xx.patch
//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.
//
git revert 9ca532610fa179911b23e244c96db10c140639f2 // 取消某次提交
//
git checkout . // 还原(覆盖)本地的修改
//
git cherry-pick 9ca532610fa179911b23e244c96db10c140639f2 //将远程分支对应的补丁打过来。
删除分支:
1 删除远程分支
$ git push origin :branchName
2 删除本地分支,强制删除用-D
$ git branch -d branchName
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。