GitStreet v0.1.0 GitStreet View Source

Documentation for GitStreet.

Link to this section Summary

Functions

List of branches

Switch branches or restore working tree files

Clone a repository into a new directory. You can set path option and set the name of a new directory to clone into.

Shows the commit logs. You can set limit option and function returns limited output of commits.

Entrypoint for further working with existing git repository.

Link to this section Functions

Link to this function

branch(arg1)

View Source
branch(%GitStreet.Repo{path: term()}) :: list()

List of branches

Examples

iex> GitStreet.branch(%GitStreet.Repo{path: "/user/repo/path"})
["master", "release", "feature/123"]
Link to this function

checkout(arg1, branch_name)

View Source
checkout(%GitStreet.Repo{path: term()}, String.t()) :: tuple()

Switch branches or restore working tree files

Examples

iex> GitStreet.checkout(%GitStreet.Repo{path: "/user/repo/path"}, "my_branch")
{:ok, "Switched to branch my_branch"}

iex> GitStreet.checkout(%GitStreet.Repo{path: "/user/repo/path"}, "nonexistent_branch")
{:ok, "Couldn`t switch to nonexistent_branch"}
Link to this function

clone(link, options \\ [])

View Source
clone(String.t(), keyword()) :: String.t()

Clone a repository into a new directory. You can set path option and set the name of a new directory to clone into.

Examples

iex> GitStreet.clone("git@provider.com:repo_name.git")
%GitStreet.Repo{path: "/current/directory/path/repo_name/.git"}

iex> GitStreet.clone("git@provider.com:repo_name.git", path: "/users/directory/path")
%GitStreet.Repo{path: "/users/directory/path/repo_name/.git"}
Link to this function

log(repository, options \\ [])

View Source
log(%GitStreet.Repo{path: term()}, keyword()) :: [map()]

Shows the commit logs. You can set limit option and function returns limited output of commits.

Examples

iex> GitStreet.log(%GitStreet.Repo{path: "/user/repo/path"})
[%{
  author_name: "Author Name",
  author_email: "author.name@gmail.com",
  created_at: "Tue Feb 4 14:13:37 2020 +0200",
  hash: "fa6ff4e6b12b90b035671d1eb44a7762191c175c",
  message: "commit message"
},
%{
  ....
}]

iex> GitStreet.log(%GitStreet.Repo{path: "/user/repo/path"}, limit: 1)
[%{
  author_name: "Author Name",
  author_email: "author.name@gmail.com",
  created_at: "Tue Feb 4 14:13:37 2020 +0200",
  hash: "fa6ff4e6b12b90b035671d1eb44a7762191c175c",
  message: "commit message"
}]

Entrypoint for further working with existing git repository.

Examples

iex> GitStreet.open
%GitStreet.Repo{path: "/current/directory/path/.git"}

iex> GitStreet.open("/user/repo/path")
%GitStreet.Repo{path: "/user/repo/path/.git"}
Link to this function

open(path)

View Source
open(Path.t()) :: %GitStreet.Repo{path: term()} | {:error, binary()}