Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I create a new branch? #36

Closed
iannil opened this issue Sep 24, 2012 · 11 comments
Closed

how can I create a new branch? #36

iannil opened this issue Sep 24, 2012 · 11 comments

Comments

@iannil
Copy link

iannil commented Sep 24, 2012

Hi , I need to create a new branch like fork on github with php , is there any api can solve it?thx

@chobie
Copy link
Member

chobie commented Sep 24, 2012

I haven't implemented that API. I'll add it later

http://libgit2.github.com/libgit2/#HEAD/group/reference/git_reference_create_oid

also, this documents are useful.
http://ftp.newartisans.com/pub/git.from.bottom.up.pdf

@iannil
Copy link
Author

iannil commented Sep 24, 2012

ok , thans for your reply and php-git is very helpful and usefull.
i will pay attention for this api.

@iannil iannil closed this as completed Sep 24, 2012
chobie added a commit that referenced this issue Sep 24, 2012
now, you can create a branch like this.

````
$repo = new Git2\Repository(".git");
$branch_name = "refs/heads/feature/create_branch";
$oid_or_symbolic_ref = "b4fd0a854ae8a6a02c89ab08e3e2f41bd4832ff1";
$force = false;
$ref = Git2\Reference::create($repo, $branch_name, $oid_or_symbolic_ref, $force);
````

this API throws \RuntimeException when failed.
@chobie
Copy link
Member

chobie commented Sep 24, 2012

hey @ZhuRong I've added the API. please create a ticket if you found some required API.

@iannil
Copy link
Author

iannil commented Sep 25, 2012

hi, @chobie ,thanks for adding the API so fast and I will try it in near future.

@iannil iannil reopened this Sep 27, 2012
@iannil
Copy link
Author

iannil commented Sep 27, 2012

hi , @chobie , thanks very much for your help first.
Git2\Reference::create is useful and works well now , and how to checkout the branch?

@chobie
Copy link
Member

chobie commented Sep 27, 2012

did you mean checkout specified commit into working directory? also that API doesn't implement yet.
I'll add checkout API soon.

@iannil
Copy link
Author

iannil commented Sep 27, 2012

ok and I am waiting for it.

@chobie
Copy link
Member

chobie commented Sep 27, 2012

@ZhuRong sorry, that API still experimental. you should execute git checkout with shell.

@iannil
Copy link
Author

iannil commented Sep 27, 2012

Did you mean that API is experimental in library named libgit2?

@chobie
Copy link
Member

chobie commented Sep 27, 2012

http://libgit2.github.com/libgit2/#HEAD/group/checkout/git_checkout_tree

specifically, there is git_checkout_tree API in libgit2. and it seems work in progress.
so I'd like to add this API into phpgit when libgit2 tagged next version.

@iannil
Copy link
Author

iannil commented Sep 27, 2012

Oh,I'll keep attention with it and maybe I should execute checkout with shell until libgit2 tagged next version.
Thanks for your help again.Good night at last :-)

@iannil iannil closed this as completed Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants