我正在编写一个简单的代码来实现git checkout branch-name
git_repository *repo = NULL;
git_signature *sig;
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
git_signature_now(&sig, "name", "email");
git_repository_open(&repo, "test");
git_repository_set_head(repo, "refs/heads/v1", sig, NULL);
git_checkout_tree(repo, NULL, &opts);
git_signature_free(sig);
git_repository_free(repo);
除了文件模式更改外,一切正常。
$ git status
On branch v1
Your branch is up-to-date with 'sugareps/ibm_r22'.
Changes to be committed:
modified: include/javascript/select2/select2-spinner.gif
modified: include/javascript/select2/select2.png
Changes not staged for commit:
modified: /modules/DropDownBrowser.php
$git diff # or git diff --cached
old mode 100644
new mode 100755
我该怎么做?有人可以给我一些建议。