Skip to content

Commit

Permalink
Merge pull request #21707 from JuliaLang/ksh/checkoutex
Browse files Browse the repository at this point in the history
Add example for checkout
  • Loading branch information
kshyatt authored May 7, 2017
2 parents 4d08b54 + 14da9d3 commit f4cd98b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions base/libgit2/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,23 @@ Equivalent to `git checkout [-f] --detach <commit>`.
Checkout the git commit `commit` (a [`GitHash`](@ref) in string form)
in `repo`. If `force` is `true`, force the checkout and discard any
current changes. Note that this detaches the current HEAD.
# Example
```julia
repo = LibGit2.init(repo_path)
open(joinpath(LibGit2.path(repo), "file1"), "w") do f
write(f, "111\n")
end
LibGit2.add!(repo, "file1")
commit_oid = LibGit2.commit(repo, "add file1")
open(joinpath(LibGit2.path(repo), "file1"), "w") do f
write(f, "112\n")
end
# would fail without the force=true
# since there are modifications to the file
LibGit2.checkout!(repo, string(commit_oid), force=true)
```
"""
function checkout!(repo::GitRepo, commit::AbstractString = "";
force::Bool = true)
Expand Down

2 comments on commit f4cd98b

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

Please sign in to comment.