发布于 2014-10-16 06:55:23 | 273 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Git教程,程序狗速度看过来!

Git分布式版本控制系统

Git是一款自由和开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。


//创建本地仓库
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/mygit/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 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.
 
//
git revert 9ca532610fa179911b23e244c96db10c140639f2 // 取消某次提交
 
 
//
git checkout . // 还原(覆盖)本地的修改
 
//
git cherry-pick  9ca532610fa179911b23e244c96db10c140639f2  //将远程分支对应的补丁打过来。
git clean -df //delete所有未跟踪的目录及文件
 
 
删除分支: 
1 删除远程分支 
$ git push origin :branchName 
2 删除本地分支,强制删除用-D 
$ git branch -d branchName


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务