Welcome 微信登录
编程资源 图片资源库 蚂蚁家优选 PDF转换器

首页 / 操作系统 / Linux / 使用Git打包patch补丁

第一次的时候需要先创建一个本地代码库:初始化一个新的git仓库
在一个已存在的目录中初始化git存储,只要在目录下输入"git init"命令即可。这样会为这个目录生成一个基本的git存储框架。
$ rails myproject
$ cd myproject
$ git init
现在,就有了一个空的git存储(你可以查看目录下的".git"目录)。现在就可以stage和提交(commit)文件到这个目录了。分别使用"git add"和"git commit"命令。 $ git add .
$ git commit -m "initial commit"这样你就有了一个完整的提交之后的git存储了,可以运行"git log"
$ git log

第二步查看修改 git diff xxxx
第三步提交修改运行 "git commit -a" 命令,效果跟在SVN中使用"commit"命令一样。$ git commit -a执行完之后,一个提交信息的提示会出现在编辑器中(这里$EDITOR环境变量或"core.editor"这两个git配置变量的默认值都是vim)类似下面这样的内容:_
# Please enter the commit message for your changes. Lines starting
# with "#" will be ignored, and an empty message aborts the commit.
# On branch main
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# modified:   README
#                                                                     
~                                                                                     
~                                                                                     
".git/COMMIT_EDITMSG" 9L, 253C输入一些提交的信息,譬如"added myself to the README as an author"然后退出。
第四步打成Patch包git log 查看提交的idgit format-patch xxxxxxxxxxxxx(commit id)