Get latest release using nodegit - nodegit

How can I get the code from latest release of a Github repository using nodegit?
I went through this API guide. I also look around in nodegit user guides. There are examples to get the latest commit - but not the latest release.
Note: I would like to use nodegit instead of github's api because I would like to make my code work with an internal git repository at a later point in time.

This is what I ended up doing:
Git clone to a common location, if this is the first time I am executing. Example from nodegit.
Git fetch on the location, for subsequent runs.
Once the repository is cloned to local machine, we can get the latest release from there to whichever work-space directory that we need it at.

Related

How can I connect my Repl.it repl to my existing GitHub repository?

I am developing a custom Discord bot using NodeJS and have been hosting it on Repl.it for some time. I connected my repl to a GitHub repository for version control but later I had to fork my repl and create a new one. I deleted the old repl.
Now, when I make a change on the new repl and try to commit the changes to the GitHub repository, nothing changes (the new commits do not show up on GitHub but do show up on Replit). There is a button "Connect to GitHub" in Replit which only lets me create a new repository which I do not want. I want to link my new repl to my old GitHub repository.
How can I achieve this?
Replit provides a shell and has git installed, so you can use the shell to run git commands directly, which is more convenient.
You can create a new repo, and click shell (in the right panel).
Type the following;
git init
git remote add origin <git_url>
git fetch
git reset origin/<branch_name> --hard
Once done, the version control in the left panel will also be synchronized.
Of course, you can also push changes made in replit back to GitHub, also using the shell.
git push origin master

Node.js update via GitHub

So I am currently using node.js to make a Discord bot. I am switching the way things work however. The bot runs from my machine (computer), but I would like my friends to be able to work on it as well. Is there any way we can clone a GitHub repo into an existing folder, as to update the current BOT.js file we have?
The point of this is to have the bot auto update via github
You can create an empty Github repository, make sure to create it without any readme etc before you have made your first push.
Then using git, you initialize a git repo inside your current folder you are working out of, when you have done that, you can set a upstream to Github (w/ the repository URL you got for your newly created repository (on Github)), then just commit your files, push them to the Github repo master branch and you should be good to go.
Hope that helps!

Get the latest update time of a specific folder in a repo using Github API

How can I get the latest update time of a specific folder in a repo using Github API?
I've tried
https://api.github.com/repos/User/Repo/contents
but it did not return any information about the latest update time.
or is it impossible for Github to do it?
You can fetch the list of commits for that path with the Commits API:
https://developer.github.com/v3/repos/commits/#list-commits-on-a-repository
If you look at the first commit in the returned list, that's the most recent commit which modified something in that folder. The date on which the commit was created is what you're looking for.

GitLab not able to sync fork

I recently installed GitLab, however, I can't figure out how to use forks properly. I have the following versions installed:
GitLab 7.7.1
GitLab Shell 2.4.1
GitLab API v3
Ruby 2.1.4p265
Rails 4.1.1
I have found out the URL for forks (by creating another user and adding it to the project, but it doesn't show up in the GUI on own projects, link http://server.com/<user>/<repo>/fork/new works though), and once a fork has been made, it is not possible to sync the fork. At least, there's nothing I can find on Google nor the documentation for GitLab, but it is mentioned in changelogs at places or issues that apparently have been accepted (can't find the source anymore though).
Can anyone explain me how forking works and how I can sync the fork once the original repository has been updated?
how I can sync the fork once the original repository has been updated?
Simply by adding a remote reference to the original repo: see "Pull new updates from original Github repository into forked Github repository".
The opposite (from fork to original repo) is done using merge request: see "GitLab Flow"

What is the best solution for strictly local version control?

I am using Visual Studio 2012 on my home PC and I have been looking for a way to implement version control locally. I use Team Foundation Server at work, and have never used anything else. I am not trying to connect to my work server, I just want version control for my home projects.
I tried Git Tools for Visual Studio, which works ok - but it doesn't support reverting to a previous commit. Every time I've needed to revert, I've had to go to the Git repository website, download that commit, and replace the files on my machine.
Is there anything out there that supports similar version control to TFS?
Git is a good option because it keeps a complete copy of the repository version history locally-- you never need to push changes to an external server. You can read about setting up a local repository here.
Once you have a repository set up and some changes committed, you can use git reset --hard <commit> to reset to that commit. See documentation here. Note that this will wipe out any pending AND committed changes on top of the referenced commit.

Resources