Reputation: 1251
how to use libgit2 to get a SHA value when i want to commit a new file to git The command in shell is:
git add
git commit
git pull
git push
Upvotes: 0
Views: 413
Reputation: 67609
The following libgit2 tests should get you started:
commitstagedfile.c: how to git add
a file to the staging area, then perform a git commit
and retrieve the sha of the created commit.
fetch.c: how to git fetch
and update the content of the local repository with upstream changes
push.c: how to submit the local changes to the upstream repository, similarly to git push
Note: git pull
is a combination of git fetch
and git merge
. The merging capabilities are not available yet in libgit2.
Upvotes: 1